Spirit Parsers are not designed to be used with auto
in Spirit V2.
This is because the underlying Proto expression templates hold references to the temporaries.
You can use
qi::copy()
(existing in the trunk after boost_1_55_0, not in any released version at this time)boost::proto::deep_copy
- or BOOST_SPIRIT_AUTO (first coined here)
I’ve written about these things more often on SO: https://stackoverflow.com/search?q=user%3A85371+deep_copy, specifically, this:
Boost Spirit X3 will not have this limitation.