#include #include #include #include #include #include #include #include #include #include #include namespace qi = boost::spirit::qi; namespace ascii = boost::spirit::ascii; class Foo { public: Foo() {} Foo(unsigned, unsigned) {} Foo(const boost::fusion::vector & v) {} unsigned a; unsigned b; }; // Fails to build without the latter #if 0 BOOST_FUSION_ADAPT_STRUCT( Foo, (unsigned, a) (unsigned, b) ) #endif template struct FooParser : qi::grammar(), ascii::space_type> { qi::rule foo; qi::rule foo_workaround; qi::rule(), ascii::space_type> start; FooParser() : FooParser::base_type(start) { using qi::hex; foo_workaround = hex >> "," >> hex; foo %= foo_workaround.alias(); start %= *foo; } }; int main() { std::string s; using boost::spirit::ascii::space; FooParser g; std::vector data; std::string::const_iterator iter = s.begin(); std::string::const_iterator end = s.end(); bool r = phrase_parse(iter, end, g, space, data); return 0; }