1 Jan 03:59
Parsing Doubles (Scientific Notation)
Jon Lederman <jonlederman <at> gmail.com>
2010-01-01 02:59:09 GMT
2010-01-01 02:59:09 GMT
Hi All,
I am a newbie to spirit. I am attempting to parse a list of doubles
and have have the following parser setup:
namespace client
{
namespace qi = boost::spirit::qi;
namespace ascii = boost::spirit::ascii;
void print (float const& d)
{
std::cout<< d << std::endl;
}
template <typename Iterator>
bool parse_numbers(Iterator first, Iterator last)
{
using qi::double_;
using qi::phrase_parse;
using ascii::space;
bool r = phrase_parse(
first, /*< start iterator >*/
last, /*< end iterator >*/
double_[&print]>> *(',' >> double_[std::cout << _1 << '\n']),
/*< the parser >*/
space /*< the skip-parser >*/
);
if (first != last) // fail if we did not get a full match
return false;
return r;
(Continue reading)
But a promise is a promise :P
Regards,
RSS Feed