Boost.Spirit. Karma: Kleene star with space separator
Hello There is an example of usage Keele star with Karma generator: http://www.boost.org/doc/libs/1_60_0/libs/spirit/doc/html/spirit/karma/refer... std::vector<double> v; v.push_back(1.0); v.push_back(2.0); v.push_back(3.0); test_generator_attr_delim("1.0 2.0 3.0 ", *double_, space, v); How could the remaining space be omitted? Is (double_ % space) supposed to be used instead for such cases?
There is an example of usage Keele star with Karma generator: http://www.boost.org/doc/libs/1_60_0/libs/spirit/doc/html/spirit/karma/ref erence/operator/kleene.html
std::vector<double> v; v.push_back(1.0); v.push_back(2.0); v.push_back(3.0); test_generator_attr_delim("1.0 2.0 3.0 ", *double_, space, v);
How could the remaining space be omitted? Is (double_ % space) supposed to be used instead for such cases?
Yes. Regards Hartmut --------------- http://boost-spirit.com http://stellar.cct.lsu.edu
01.03.2016 16:53, Hartmut Kaiser пишет:
There is an example of usage Keele star with Karma generator: http://www.boost.org/doc/libs/1_60_0/libs/spirit/doc/html/spirit/karma/ref erence/operator/kleene.html
std::vector<double> v; v.push_back(1.0); v.push_back(2.0); v.push_back(3.0); test_generator_attr_delim("1.0 2.0 3.0 ", *double_, space, v);
How could the remaining space be omitted? Is (double_ % space) supposed to be used instead for such cases?
Yes.
Many thanks. I've found that % operator fails on empty containers whereas Kleene* doesn't.
Regards Hartmut --------------- http://boost-spirit.com http://stellar.cct.lsu.edu
01.03.2016 16:53, Hartmut Kaiser пишет:
There is an example of usage Keele star with Karma generator:
http://www.boost.org/doc/libs/1_60_0/libs/spirit/doc/html/spirit/karma/ref
erence/operator/kleene.html
std::vector<double> v; v.push_back(1.0); v.push_back(2.0); v.push_back(3.0); test_generator_attr_delim("1.0 2.0 3.0 ", *double_, space, v);
How could the remaining space be omitted? Is (double_ % space) supposed to be used instead for such cases?
Yes.
Many thanks. I've found that % operator fails on empty containers whereas Kleene* doesn't.
You can use -(double_ % ' ') to support empty containers. Regards Hartmut --------------- http://boost-spirit.com http://stellar.cct.lsu.edu
participants (2)
-
Hartmut Kaiser
-
Matwey V. Kornilov