
I have tried to use lexical_cast many times but I always run into problems sooner or later due to the lack of locale support. Why not add a locale overload (or default argument) to lexical_cast. std::string x = lexical_cast<std::string>(1234); // "1 234" on my PC std::string y = lexical_cast<std::string>(1234, std::locale::classic ()); // "1234" on my PC double xmlDbl1 = lexcal_cast<double>("1.23"); // bad_cast on my PC double xmlDbl2 = lexcal_cast<double>("1.23", std::locale::classic()); The change would be minimal lexical_stream() { becomes lexical_stream(const std::locale& loc) { stream.imbue(loc); and template<typename Target, typename Source> Target lexical_cast(Source arg) { detail::lexical_stream<Target, Source> interpreter; becomes template<typename Target, typename Source> Target lexical_cast(Source arg, const std::locale& loc = std::locale()) { detail::lexical_stream<Target, Source> interpreter(loc);