
Le 06/04/2011 20:08, TONGARI a écrit :
Does my first suggestion solve your first attempt? i.e. (ostream&)m_error << ...
I don't have see our answer in our previous mail. I have test it with m_error as std::stringstream and phx::ref( (ostream&)m_error ). And it works fine !!! Thanks a lot for our help Note that there is a compilation error with *std::ostringstream* m_error and phx::ref( m_error )
for example if my start rule is start = qi::char_("a-z") > qi::char_("!");
and I parse the string "a#" then I expect that _4 contain "!" , phx::bind(&boost::spirit::info::tag, qi::_4) return "literal-char"
2 questions : a) I have a look in boost::spirit::info class is the boost::spirit::info::value member is containing the data I want ( ie "!")
True here, but it's a more subtle thing than I can explain... Not every case can you get a utf8_string form boost::spirit::info::value.
For example, "... > qi::char_('a', 'z')" you can get the value as a utf8_string "a-z"; while "... > qi::char_("a-z")" you can only get a nil object from value.
OK
b) perhaps it exists an alternative like phx::construct<>( phx::val("") << _4 )
I don't know what you mean here.
With this kind of proposition I will hope to hack the string construction (m_error in this case is a std::string). a) phx::constructstd::string( phx::val("...") ) is a valid expression b) phx::val("...") << _4 is a valid expression c) phx::constructstd::string( phx::val("...") << _4 ). The evaluation on this expression first compute (exp. b) phx::val("...") << _4 then then apply (a) evaluation. For my application I will use our workarond, thanks again Vincent Agnus