I have this typical Spirit code.
#include <boost/spirit/home/x3.hpp>
#include <boost/fusion/container/vector.hpp>
#include<iostream>
using std::cout;
int main(){
namespace x3 = boost::spirit::x3;
boost::fusion::vector<double, double> p;
x3::phrase_parse(
s.begin(), s.end(),
x3::double_ >> x3::double_, x3::space,
p
);
assert( boost::fusion::at_c<0>(p) == 1.2 );
assert( boost::fusion::at_c<1>(p) == 3.4 );
}
I am wondering is it possible to deduce the type of the expected attribute from the grammar?
Something like
using att_type = decltype(x3::double_ >> x3::double_)::result_type;
that deduces boost::fusion::vector<double, double>
.
I found this http://boost-spirit.com/home/2010/01/31/what-is-the-attribute-type-exposed-by-a-parser/ but it doesn't work with x3
or I am not including the right headers.