Boost logo

Boost Users :

Subject: Re: [Boost-users] program_options and wstrings
From: Yang Zhang (yanghatespam_at_[hidden])
Date: 2009-11-09 04:58:47


On Sun, Nov 8, 2009 at 11:52 PM, Vladimir Prus
<vladimir_at_[hidden]> wrote:
> Yang Zhang wrote:
>>
>> - value vs. wvalue
>
> If your option type can be constructed from char* (either using custom
> validator, or operator>>), you can use value.
> If your option type can be constructed from wchar_t, you can use wvalue.
> If both, wvalue is a better since you won't loose data no matter what
> kind of parser is used.

Why would you ever lose data? UTF-8 and UTF-16 are both encodings of
the same set of characters. Isn't that what codecvt converts between?

> Given what wstring cannot be constructed from char*, you have to
> use wvalue for wstring.

You can't construct a vector<...> from a char* either, yet that's
legal. See my confusion? :) This is why it's unclear to me what
significance value vs. wvalue have - esp. since codecvt is doing
conversions anyway.

-- 
Yang Zhang
http://www.mit.edu/~y_z/

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