Boost.Spirit Karma: how to store generator?
Hello, After reading Karma tutorial, I still don't understand whether there a way to store generator except auto my_generator = ... I would like to generate text representation for many similar objects and I think that it is worth to use single generate object and pass it to generate_delimited() by const reference. Are there such things like qi::rule<> and qi::grammar for Karma?
On Sun, 28 Feb 2016 22:05:44 +0300
"Matwey V. Kornilov"
Hello,
After reading Karma tutorial, I still don't understand whether there a way to store generator except
auto my_generator = ...
I would like to generate text representation for many similar objects and I think that it is worth to use single generate object and pass it to generate_delimited() by const reference.
Are there such things like qi::rule<> and qi::grammar for Karma?
Karma has both a rule and a grammar [0]. The C++11 auto can be used with Karma in various ways, but be careful of copies. Karma uses C++03 Boost.Proto which stores references and does a shallow copy in its copy constructor. See Boost.Proto.DeepCopy [1]. Lee [0]http://www.boost.org/doc/libs/1_60_0/libs/spirit/doc/html/spirit/karma/refer... [1]http://www.boost.org/doc/libs/1_60_0/doc/html/boost/proto/functional/deep_co...
participants (2)
-
Lee Clagett
-
Matwey V. Kornilov