Boost logo

Boost Users :

Subject: Re: [Boost-users] Unicode option in program_options
From: John Dlugosz (JDlugosz_at_[hidden])
Date: 2010-08-13 12:33:30


> > see reference to class template instantiation
> 'boost::program_options::typed_value<T,charT>' 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 _except_ for wstring, which needs to use po::wvalue<T> instead?


    ("datadir",
       po::wvalue<std::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.

Instead, each gives different errors. I have to use the two-arg form, which I believe is a pass-through value which won't be digested and parsed but simply assigned, and a display value to use in printing help.

Can someone explain things better? Maybe I can edit the docs or improve the tutorial, once I understand it myself.

--John





TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net