-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Jonathan Turkanis Sent: Thursday, June 02, 2005 1:48 PM To: boost-users@lists.boost.org Subject: [Boost-users] Re: lexical_cast
ian whittley wrote:
int to(std::string const& arg, Type2Type<int> const&) { return atoi(arg.c_str()); }
This won't reflect the global C++ locale.
Jonathan
Please forgive my ignorance if I'm wrong but I thought the C++ locale underneath calls ::setlocale to set the global C locale and then ::atoi uses the LC_NUMERIC category of the current C locale so everything should be fine locale-wise. In fact I thought the conversion through std::stringstream ends up using std::num_get which ends up using ::strtoul. On the other hand, can boost::lexical_cast accept a hex string and correctly convert it to its numeric representation? If so the ::atoi shortcut would not work... -delfin