mrosenbladt / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

Improve the syntax of the new API to prevent unintuitive behavior #208

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
One of the nice things about the new API is that it lets you easily modify 
nodes, e.g.:

foo["x"] = 5;

However, this currently causes the following behavior (see Issue 207):

Node a;
a = foo{"x"];
// ...
a = foo["y'];  // <-- this line is the same as foo["x"] = foo["y"], which 
modifies the document

This is unintuitive. It would be nice to support the former behavior but 
prevent the latter.

Original issue reported on code.google.com by jbe...@gmail.com on 7 Jun 2013 at 9:41

GoogleCodeExporter commented 9 years ago
Issue 207 has been merged into this issue.

Original comment by jbe...@gmail.com on 7 Jun 2013 at 9:41

GoogleCodeExporter commented 9 years ago
Issue 285 has been merged into this issue.

Original comment by jbe...@gmail.com on 20 Mar 2015 at 3:59

GoogleCodeExporter commented 9 years ago
May be a solution to have an operator= which applies only to const objects and 
does not modify the object?

Original comment by lucamart...@gmail.com on 20 Mar 2015 at 4:06

GoogleCodeExporter commented 9 years ago
There shouldn't even be an overload to operator= on const objects - please see 
my comment on Issue 285 (which I just merged into this).

Original comment by jbe...@gmail.com on 21 Mar 2015 at 4:41