Open alfC opened 8 years ago
Yes, multiple attributes are not supported. Use a tuple or fusion sequence.
Ok, I was wondering if that was an oversight. I was confused because because it was supported in Qi and even appears in one of Mike Caise examples of X3 (in one slide).
Why is the multiple attr deprecated? It made the syntax and overloading too complicated? If so I think it is a good idea.
Although it would be nice to support at least in-place creation of ties, which is not allowed now.
phrase_parse( , , double_ >> double_, std::tie(a, b));
On Mon, Sep 19, 2016 at 8:50 PM, Joel de Guzman notifications@github.com wrote:
Yes, multiple attributes are not supported. Use a tuple or fusion sequence.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
x3 is meant to be as simple as possible and remove features that can be easily done by the user. That said, i'll consider a proper patch.
I think maintaining it minimal it is a good thing, and in fact it can be implemented by the user (as I tried to do). The only problem is that it is confusing as it is right now with the examples in http://ciere.com/cppnow15/x3_docs/spirit/abstracts/compound_attributes.html
Right. It is a doc bug. It seems ported from the Qi docs.
I fall into the trap ! It has not been corrected in the documentation. https://stackoverflow.com/questions/48026044/boost-spirit-x3-parser-doesnt-work-with-multiple-attribute
Sorry about that. Actually, I am considering adding this "feature" as alfC noted. Anyone, please feel free to issue a PR to finally settle this issue.
In Spirit v3 (distributed with boost 1.60) the following code doesn't compile:
double d1 = 0.0, d2 = 0.0;
x3::phrase_parse(begin, end, x3::double_ >> x3::double_, x3::space, d1, d2);
The problem is passing two attribute arguments (passing only
std::pair<double, double>
works). As a temporary workaround I use this code: