Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Spirit Karma: how to store generator?
From: Lee Clagett (forum_at_[hidden])
Date: 2016-02-28 14:58:22

On Sun, 28 Feb 2016 22:05:44 +0300
"Matwey V. Kornilov" <matwey.kornilov_at_[hidden]> wrote:
> 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].



Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at