[spirit] reading vector of string
Hi there, can I use push_back_a with std::vectorstd::string? I want something like this: std::vector< std::string > lines; rule<> l_entry = blanks_p >> *print_p[push_back_a( lines )] >> blanks_p >> eol_p; Regards, Christian
On Wed, Jul 16, 2008 at 11:30:46AM -0400, Christian Henning wrote:
Hi there, can I use push_back_a with std::vectorstd::string? I want something like this:
std::vector< std::string > lines; rule<> l_entry = blanks_p >> *print_p[push_back_a( lines )] >> blanks_p >> eol_p;
Since your rule probably returns an iterator pair, you need to create
the std::string first. To this end, you can leverage phoenix to create a
lazy functor [1], e.g.
struct push_back_impl
{
template
participants (2)
-
Christian Henning
-
Matthias Vallentin