I've been fiddling with some boost spirit stuff, and my code seems to start infinitely looping somewhere in the standard library stuff.
Any ideas what's wrong?
The qi::phrase_parse works very well, but the karma gets me.
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
//#include <boost/spirit.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/karma.hpp>
using namespace std;
int main()
{
using namespace boost::spirit;
string input = "100 , 200 , 200 , 300 , 300, 300, 400, 400, 400, 400";
vector<int> r;
//int value = 0;
//boost::spirit::qi::parse(input.begin(),input.end(),boost::spirit::qi::int_, value);
//cout << value << endl;
qi::phrase_parse( input.begin(), input.end(), *(qi::int_), (*(qi::space) >> ',' >> *(qi::space)), r);
string out;
back_insert_iterator<string> inserter(out);
karma::generate_delimited( inserter, '(' << karma::int_ << ')', (*(karma::space) << ',' << *(karma::space)), r);
cout << out << endl;
//for_each(r.begin(), r.end(), [] (int n) { std::cout << n << std::endl; } );
}
In the middle of this document:
http://www.boost.org/doc/libs/1_48_0/libs/spirit/doc/html/spirit/abstracts/attributes/compound_attributes.html