Hi, I started using the program_options library and I have a question about using the exceptions thrown by the library. I'd like to localize the errors reported by the library, but I can't see why the members of the exception classes are private, or why are there no getters to retrieve the properties needed to re-construct the messages in another language. Also, I can't make default wstring values work...my attempt is: #include <boost/program_options.hpp> #include <string> using namespace std; using namespace boost::program_options; int main() { wstring lang; options_description lang_opt_desc; variables_map vm; lang_opt_desc.add_options() ("lang", wvalue<wstring>(&lang)->default_value(L"en_US"), "Language ID.") return 0; } fails with both gcc and msvc, saying that boost/lexical_cast.hpp(174) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'std::basic_string<_Elem,_Traits,_Ax>' (or there is no acceptable conversion) (I'm using Boost 1.34.1 with MSVC 9.0 and g++ 4.2.3). I looked in the code and it looks that I could use ... ("lang", wvalue<wstring>(&lang)->default_value(L"en_US", "en_US"), "Language ID.") ... which works fine...I just wanted to know whether this is the intended approach. Thanks, Filip
participants (1)
-
Filip Konvička