John Dlugosz wrote:
see reference to class template instantiation 'boost::program_options::typed_value
' being compiled with [ T=std::wstring, charT=char ] You should consider po::wvalue<> template function.
Thanks Mickaƫl, that is better.
So, why does po::value<T> work for whatever type I want my parameter to be
Not really -- it works for whatever type you can extract out of stringstream, not whatever type.
_except_ for wstring,
and wstring cannot be extracted from stringstream.
which needs to use po::wvalue<T> instead?
("datadir", po::wvaluestd::wstring()->default_value(std::wstring(L"."),"."), "the directory")
Now getting default_value to work with that was some trial and error. It didn't take L".", which is exactly what parse_command_line is going to be finding were it not the default. I would expect a token in either wide or narrow forms to work, and give the same results as those tokens would if found in the argv array.
default_value is another victim of the fact that wstring cannot be converted to string. I am not sure much can be done on program_options side. - Volodya