boost::spirit::actor doesn't accept a std::vector<int>

I

Ingo Nolden

Hi,

I am using spirit 1.31
I have been trying the following example from the spirit docs. I tried it
with int and double neither works:

vector<int> v;
rule<> r = list_p(int_p[push_back_a(v)], ch_p(','));

but it gives the weird messages:

boost\spirit\actor\push_back_actor.hpp(61) : error C2078: too many
initializers

and

boost\spirit\actor\push_back_actor.hpp(61) : error C2440: 'initializing'
: cannot convert from 'const iterator_t ' to 'value_type'

When I put v into another vector:

vector< vector< int > > v;

it will compile fine, but it will put the first char into one int, and the
nested vectors will contain only this one int.

I am including these spirit headers:

#include <boost/spirit/core.hpp>
#include <boost/spirit/utility/confix.hpp>
#include <boost/spirit/utility/lists.hpp>
#include <boost/spirit/utility/escape_char.hpp>
#include <boost/spirit/actor/push_back_actor.hpp>

Am I missing a header file? I tried also assign_a with an int. That worked
fine. So I expected the above would parse numbers into int or double
variables.

thank you for your help.
Ingo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top