Boost logo

Boost :

From: rogeeff (rogeeff_at_[hidden])
Date: 2002-01-17 15:25:24


--- In boost_at_y..., "joel de guzman" <djowel_at_g...> wrote:
>
[...]
>
> Ok here's a quick shot at it:
> Borland 5.5.1
>
> ////////////////////////////////////////////////////////////////////
///////////
> Hand coded {based on Gennadiy's code}:
> 181K {includes main driver code}

25k using MSVCSP5; release mode.

>
> bool
> parse_complex(char const* in, double& r, double& i)
> {
> // parses complex numbers of the form r or (r) or (r,i)
>
> tokenizer<> tok(in, in+strlen(in));
> tokenizer<>::iterator iter=tok.begin();
>
> r = lexical_cast<double>(*iter++);
> i = lexical_cast<double>(*iter);
> }
>
> Note: This code allows improper syntax such as "(((1,,,()(2)((("
> Needless to say, adding more code to conform to the
> grammar will increase the code size.

Not signiifcantly (using returnable delimeters). More over sometimes
I would not want tight semantic defined in your implementation.

[...]

> Cheers,
> --Joel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk