Search code examples
c++parsingautoboost-spirit-qiboost-tuples

Boost Spirit Auto Parser fails for a tuple of doubles


At the following code I am trying to use Boost Spirit Auto Parser for a sequence or two doubles, but it doesn't compile. What am I doing wrong here?

// file main.cpp

#include <boost/tuple/tuple.hpp>
#include <boost/spirit/include/qi.hpp>

namespace qi = boost::spirit::qi;

int main()
{
    boost::tuple<double, double> p;
    char* i = 0;
    qi::phrase_parse( i, i, p, qi::space );
    // qi::phrase_parse( i, i, qi::double_ >> qi::double_, qi::space, qi::skip_flag::postskip, p );

    return 0;
}

The commented out line compiles, so it accepts boost::tuple<double, double> as the attribute type of qi::double_ >> qi::double_; but it fails to obtain the parser from the attribute type. Why?


Solution

  • It's the same answer as in your other question - use boost::fusion::vector instead.