You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
outputs "In one, x = 3, y = 2". I don't think anyone would expect a change to the copy to affect the original. If I instead default-construct two and then do a copy assignment two = one, things behave as expected.
The text was updated successfully, but these errors were encountered:
It is might be in 'fix and find out' area because proto::deep_copy/BOOST_AUTO/qi::auto will start to do an actual copy then.
A workaround:
boost::spirit::qi::symbols<char, int> two;
two = one;
Kojoley
changed the title
qi::symbols copy constructor does not make an independent copy{qi,karma}::symbols copy constructor does not make an independent copy
Apr 4, 2023
@Kojoley The copy assignment also doesn't make a deep copy. I answered a similar question Apr 6 2023 on the mailing list:
It's by design, likely to make it efficient and easy (without surprises!) to use symbols in parser expressions. In effect, they get "reference semantics" just like qi::rule<> does when embedded in other rules.
You can easily deep-clone a symbol table if you need:
In Boost 1.82.0 beta 1, the following code
outputs "In one, x = 3, y = 2". I don't think anyone would expect a change to the copy to affect the original. If I instead default-construct
two
and then do a copy assignmenttwo = one
, things behave as expected.The text was updated successfully, but these errors were encountered: