
"Vladimir Prus" <ghost@cs.msu.su> wrote in message news:cmponu$27l$1@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