|
Boost : |
From: rogeeff (rogeeff_at_[hidden])
Date: 2002-01-17 02:25:28
--- In boost_at_y..., "joel de guzman" <djowel_at_g...> wrote:
>
[...]
>
> > > I would implement the same logic in 2-3 lines using tokenizer
or
> > > regexp. Something like this:
> >
> > > token_iterator it( str, " \t,()" );
^forgot parenthesis
> > >
> > > real = lexical_cast<double>( *it++ );
> > > imaginary = lexical_cast<double>( *it );
>
> It's not the same! Dan's one-liner could parse complex numbers of
the
> form:
>
> r or (r) or (r, i)
>
So do i. I just forget ot add parenthesis in the delimeters list.
> Now rewrite that again using tokenizer. Then when you are done,
> try parsing a vector of comma separated complex numbers where
> the first number parsed is the size of the vector. Of the form:
>
> N { c0, c1, c2, .... cN }
>
> With Spirit, this is still a one-liner.
I am not that familiar with regexp syntax but It should also be
possible to express with one line definition (and if you would talk
with some of the boost::format guys they would explain to you why
they regexp implementation: parsing rule can be exported into the
resource file and changed dynamically)
>
> Regards,
> --Joel
Regards,
Gennadiy.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk