-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
recursive data structures #277
Comments
Since curr is a reference to data, it is by definition identical to data. This includes that any change made to it applies to data. That is not specific to this library in any way. It is just how C++ works. What you wrote is identical to this code:
|
Hey @gregmarr I see. I just wonder if there's another way to do it without making a copy of the data? |
The library cannot store references or pointers at this point, but will always make a copy of the values to store. It thereby mimics the behavior of the STL containers. Sorry about this. |
You can't rebind references. You need to use a new reference each time, or use something like std::reference_wrapper. http://en.cppreference.com/w/cpp/utility/functional/reference_wrapper |
Hi, thanks for the great library :). I had a gotcha when working with a recursive data structure.
I was able to work around this using a pointer:
Is there a better way to work with
json
in this way?The text was updated successfully, but these errors were encountered: