
I am reading Spirit tutorial, at http://www.boost.org/doc/libs/1_54_0/libs/spirit/doc/html/spirit/qi/tutorial.... I am new to boost. It is not clear to me what the placeholder are and when using them. This is some of them: *Spirit.Qi specific Phoenix placeholders* _1, _2... , _N Nth attribute of p _val The enclosing rule's synthesized attribute. _r1, _r2... , _rN The enclosing rule's Nth inherited attribute. _a, _b... , _j The enclosing rule's local variables (_a refers to the first). _pass Assign false to _pass to force a parser failure. For example in this code : template <typename Iterator>bool parse_numbers(Iterator first, Iterator last, std::vector<double>& v){ using qi::double_; using qi::phrase_parse; using qi::_1; using ascii::space; using phoenix::push_back; using phoenix::ref; bool r = phrase_parse(first, last, // Begin grammar ( *double_[push_back(ref(v), _1)] >> *(',' >> double_[push_back(ref(v), _1)])* ) , // End grammar space); if (first != last) // fail if we did not get a full match return false; return r;} why using _1, (using qi::_1) instead of _2 (using qi::_2). Which parts of boost should I read before reading spirit. Any suggestion is welcome. Thank you. Regards Olivier
participants (1)
-
Olivier Austina