Boost logo

Boost :

Subject: [boost] [boost[program options] locale support
From: Christoph Heindl (christoph.heindl_at_[hidden])
Date: 2010-06-21 05:28:47


hi,

from the documentation [1] : "[...] the library uses the
codecvt<wchar_t, char> locale facet from the global locale."
The quote is taken from the unicode-documentation part. May i ask why
the locale is taken from the global locale, instead of the locale
assigned to the stream?

What I'd like to do is (currently yields a logic_error)

  // assume stream contains "a = 1,2"
  // ...
  std::locale loc("German_Germany");
  stream.imbue(loc);
  po::parse_config_file(stream, opts, false);

instead i have to

  std::locale loc("German_Germany");
  std::locale::global(loc);
  po::parse_config_file(stream, opts, false);

to parse the config file correctly.

Best regards,
Christoph

[1] "http://www.boost.org/doc/libs/1_43_0/doc/html/program_options/howto.html#id1421903


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk