1

How do I access tuple as back element of vector by boost::phoenix used in grammar. I want to set 2nd element of tuple of the back element of vector (which was added earlier)

for example

typedef boost::tuple<std::string, std::string, std::string> var_type;
typedef std::vector<var_type> vars_type;


template <typename Iterator>
struct some_grammar : qi::grammar<Iterator, vars_type()>
{
    some_grammar() : 
        some_grammar::base_type(some_rule)
    {
        .....
        .....
        .....
        //somewhere inside grammar
        .....

        some_rule = ... >> -some_rule2
        [
            phoenix::at_c<2, var_type>
            (
                phoenix::back(qi::labels::_val)
            ) = qi::labels::_1
        ] >>
        qi::lit(',');
     }
}

in my msvc 2008 error is

boost::phoenix::at_c' : cannot convert parameter 1 from 'boost::phoenix::actor' to 'const var_type &

obviously phoenix::at_c can not deduce tuple type from phoenix::back.

My question: How to combine phoenix statements in this case ??

manlio
  • 18,345
  • 14
  • 76
  • 126

0 Answers0