Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-11-09 14:26:42

"Vladimir Prus" <ghost_at_[hidden]> wrote in message
> 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


Boost list run by bdawes at, gregod at, cpdaniel at, john at