#include <iostream>
#include <boost/spirit/include/qi.hpp>
namespace qi = boost::spirit::qi;
int main ()
{
std::string input(" aaa ");
std::string::iterator strbegin = input.begin();
std::string p;
qi::phrase_parse(strbegin, input.end(),
qi::lexeme[+qi::char_],
qi::space,
p);
std::cout << p << std::endl;
std::cout << p.size() << std::endl;
}
In this code parser assigns "aaa "
to p
. Why doesn't it skip all spaces? I expect p
to be "aaa"
. How it can be fixed?