I am writing a Boost Spirit grammar to parse text into a vector of these structures:
struct Pair
{
double a;
double b;
};
BOOST_FUSION_ADAPT_STRUCT(
Pair,
(double, a)
(double, a)
)
This grammar has the following rule:
qi::rule<Iterator, Pair()> pairSequence;
However, the actual grammar pairSequenceis as follows:
double_ % separator
I want this grammar to create Pairwith aequal to double, and bequal to some constant. I want to do something like this:
pairSequence = double_[_val = Pair(_1, DEFAULT_B)] % separator;
The above does not compile, of course. I tried to add a constructor to Pair, but I still get compilation errors (there is no suitable function to call "Pair :: Pair" (const boost :: phoenix :: actor> &, double) ').