
It's already the case, because config file do not contain the information about the used locale. Further, even if it did, the set of locales on different computers is not the same, and on different OS even the naming may be different, so moving configuration files is hard already. This might mean I need to set classic locale for parsing, to make sure config files are really portable.
I am not familiar with the code layout for program options but with a quick look it seems like you can do it the the same way as in the streams? Add a locale reference member to the value_semantics class and an imbue method to the options_description class which specifies the default. The user can then specify exactly how he wants the options: max portablity: desc.imbue(std::locale::classic()) localized: desc.imbue(std::locale()) // should be default desc.add_options()...
That's not convenient, so probably global "lexical_cast_locale" is better. But for MT environment you need to store that global state in TSS.
The global locale can already be used so there is no need for another global locale. const std::locale old = std::locale::global(std::locale::classic()); double x = lexical_cast<double>(str); std::locale::global(old);