undefined behaviour somewhere in boost::spirit::qi::phrase_parse

淺唱寂寞╮ 提交于 2019-11-27 02:26:48
sehe

You cannot use auto to store parser expressions¹

Either you need to evaluate from the temporary expression directly, or you need to assign to a rule/grammar:

const qi::rule<std::string::const_iterator, qi::space_type> doubles_parser_local = qi::double_ >> *(',' >> qi::double_);

You can have your cake and eat it too on most recent BOost versions (possibly the dev branch) there should be a BOOST_SPIRIT_AUTO macro

This is becoming a bit of a FAQ item:

¹ I believe this is actually a limitation of the underlying Proto library. There's a Proto-0x lib version on github (by Eric Niebler) that promises to solve these issues by being completely redesigned to be aware of references. I think this required some c++11 features that Boost Proto currently cannot use.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!