Dear Experts,
I currently have something like:
struct S {
string name;
string value;
};
BOOST_FUSION_ADAPT_STRUCT( S, name, value )
using S_rule = qi::rule;
S_rule r %= identifier >> lit(':') >> identifier;
Note that I can use %= here and I don't need to write an explicit
semantic action to assign to S.
Now say I modify S:
class S
{
public:
S(string name_, string value_);
// May be default-constructable, copyable, assignable etc.
// - but name and value are not individually assignable.
};
Question: what is the best way to use that with the qi parser rule?
I was hoping to find something in Fusion that would allow me to adapt the
new class so that it can be used with %= as before, but I don't see anything
appropriate.
Currently the best that I can think of is:
S_rule r = ( identifier >> lit(':') >> identifier )
[ _val = boost::phoenix::construct<S>(_1,_2) ];
How can I improve on that?
Thanks, Phil.