
8 Apr
2009
8 Apr
'09
7:20 p.m.
Eugene Wee wrote:
Does anyone think that adding such a manipulator to Boost would be desirable? I expect the syntax to be along these lines (names and namespaces to be decided): std::cin >> match("a=") >> a; where a failure to match would place the input stream in a failed state. It would also be possible to use a std::basic_string instead of a string literal converted to a pointer to its first element as the argument.
Spirit2 already provides such functionality: #include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi_stream.hpp> [...] using namespace boost::spirit; using namespace boost::spirit::qi; std::cin >> match("a=" >> int_, a); Regards, François