This may be very obvious, but why does the stream-based parsing in boost duplicate the last letter? I must be doing something wrong:
#include <iostream>
#include <sstream>
#include <boost/spirit/include/qi.hpp>
namespace qi = boost::spirit::qi;
int main() {
std::string input = "hello";
std::stringstream ss(input);
std::string r1, r2;
boost::spirit::istream_iterator first(ss), last;
qi::phrase_parse(input.begin(), input.end(), qi::lexeme[qi::alpha >> *qi::alnum], qi::space, r1);
std::cout << r1 << std::endl; // prints "hello"
qi::phrase_parse(first, last, qi::lexeme[qi::alpha >> *qi::alnum], qi::space, r2);
std::cout << r2 << std::endl; // prints "helloo"
}
Tested with XCode 5.0 and Boost 1.54.0.
Edit: The problem seems to be specific to libc++. Anybody using Clang care to confirm?