|
Boost : |
From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-11-09 14:26:42
"Vladimir Prus" <ghost_at_[hidden]> wrote in message
news:cmponu$27l$1_at_sea.gmane.org...
> Jonathan Turkanis wrote:
> > I'm not yet familiar with the program options library. With lexical_cast,
> > there's no way to specify a locale, so I guess you're talking about
> > setting the global locale. Right? I'm afraid this might be bad manners,
> > too. Mybe I can provide both options.
>
> Or maybe lexical_cast is just bad solution. I recently wanted to read hex
> number from stream, which lexical_cast does not support. I ended up writing
> my own from_string class template which can be used like this:
>
> string s = "0x1A";
> int i = from_string<int>(std::hex)(s);
>
> and the same class can be used to pass punctuator, as well:
>
> from_string<vector<int> >(punctuator(....))(s);
Nice. This should work out-of-the-box.
> - Volodya
Jonathan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk