Skip to content

Self referencing objects in Optional #292

Discussion options

You must be logged in to vote

That wouldn't work with std::optional either (jsoncons::optional is typedefed to std::optional if C++17 is detected.) Whether jsoncons or std, optional<T> requires a complete type, it stores a T within the optional object, not on the heap.

For self referencing objects, I would suggest using std::unique_ptr instead.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@dineshkumar02
Comment options

@dineshkumar02
Comment options

Answer selected by dineshkumar02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants