灵魂分析器是不是要用于auto ? 一个简单的parsing器在传递给内联函数qi::parse()时可以正常工作,但如果通过一个autovariables传递,则会崩溃。 #include <cstdio> #include <string> #include <boost/spirit/include/qi.hpp> using namespace std; namespace qi = boost::spirit::qi; int main() { string line = "[z]"; auto bracketed_z = '[' >> +qi::char_('z') >> ']'; auto p = line.cbegin(); printf("%d", qi::parse(p, line.cend(), '[' >> +qi::char_('z') >> ']')); // Works p = line.cbegin(); printf("%d", qi::parse(p, line.cend(), bracketed_z)); // Crashes } […]