id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 6869,spirit lex use phoenixV3 compile error,anonymous,Joel de Guzman,"if #define BOOST_SPIRIT_USE_PHOENIX_V3 1 this code can't be compile error {{{ // #define BOOST_SPIRIT_LEXERTL_DEBUG #define BOOST_SPIRIT_USE_PHOENIX_V3 1 #include #include #include #include #include #include #include #include #include namespace lex = boost::spirit::lex; struct distance_func { template struct result : boost::iterator_difference {}; template typename result::type operator()(Iterator1& begin, Iterator2& end) const { return std::distance(begin, end); } }; boost::phoenix::function const distance1 = distance_func(); template struct word_count_tokens : lex::lexer { word_count_tokens() : c(0), w(0), l(0) , word(""[^ \t\n]+"") , eol(""\n"") , any(""."") { using boost::spirit::lex::_start; using boost::spirit::lex::_end; using boost::phoenix::ref; this->self = word [++ref(w), ref(c) += distance1(_start, _end)] | eol [++ref(c), ++ref(l)] | any [++ref(c)] ; } std::size_t c, w, l; lex::token_def<> word, eol, any; }; int main(int argc, char* argv[]) { typedef lex::lexertl::token token_type; typedef lex::lexertl::actor_lexer lexer_type; word_count_tokens word_count_lexer; std::string str (""Our hiking boots are ready. So, let's pack!\n\ \n\ Have you the plane tickets for there and back?\n\ \n\ I do, I do. We're all ready to go. Grab my hand and be my beau.\n\ \n\ \n""); char const* first = str.c_str(); char const* last = &first[str.size()]; lexer_type::iterator_type iter = word_count_lexer.begin(first, last); lexer_type::iterator_type end = word_count_lexer.end(); while (iter != end && token_is_valid(*iter)) ++iter; if (iter == end) { std::cout << ""lines: "" << word_count_lexer.l << "", words: "" << word_count_lexer.w << "", characters: "" << word_count_lexer.c << ""\n""; } else { std::string rest(first, last); std::cout << ""Lexical analysis failed\n"" << ""stopped at: \"""" << rest << ""\""\n""; } return 0; } }}}",Bugs,closed,To Be Determined,spirit,Boost 1.49.0,Problem,fixed,spirit lex,