
Jonathan Turkanis wrote:
If a facet is used you can use the formatter with lexical_cast and the program options library.
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); The obvious implementation is at http://zigzag.cs.msu.su/~ghost/from_string.hpp - Volodya