I am using Boost 1.44, The Spirit parser works well for numeric parsing but really is tricky for string parsing. I am trying to parse a string to be split using multiple delimiters: ',' ,';' or ' '. It works well for numbers when I do this (where vect = vector < double >):
qi::parse(first,last,double_ >> *(',' >> double_ | ' ' >> double_ | ';' >> double_),
vect,space);
However when I modify the grammer for strings using vect = vector< string >,
+char_ >> *(',' >> +char_ | ' ' >> +char_ | ';' >> +char_)
I get the following error:
/usr/include/boost/spirit/home/qi/detail/assign_to.hpp:109:13: error: invalid conversion from ‘char’ to ‘const char*’/usr/include/boost/spirit/home/qi/detail/assign_to.hpp:109:13: error: initializing argument 1 of ‘std::basic_string<_CharT, _Traits,_Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’
I narrowed down the error to being the first +char_ in the grammar syntax which is being taken as a series of chars rather than a string. Is there any way to fix this issue?
Thanks