Subject: Re: [boost] Unicode and codecvt facets
From: Bo Persson (bop_at_[hidden])
Date: 2010-07-06 13:09:19
Mathias Gaunard wrote:
> Le 05/07/2010 18:48, Bo Persson wrote:
>> You can, but you should specialize on the third parameter, if you
>> want to treat chars differently than default.
>> A codecvt<char, char, my_state_t> could easily do any kind of
>> conversions you need.
> I don't particularly need state, what I would like is to be able to
> use the right character types rather than wide characters, which are
You mean the implementation doesn't provide the right character types?
The third parameter is there so you can specialize the use of chars,
other that the default implementation's. The codecvt<char, char,
mbstate_t> does what is "standard" on the platform. If you want
something else, you need a codecvt<char, char, non_std_state_t>, even
if you don't use the state variable passed to your codecvt<>. The
standard codecvt<> doesn't use it either.
> Also it doesn't seem states other than mbstate_t can be used by
It should work, but perhaps not the most tested part on a standard
The filebuf (basic_filebuf, that is) is templated on char and
std::char_traits<char>. Again, if you want something other that
default, you need basic_filebuf<char, non_std_char_traits<char>>.
With the current standard you only have char and wchar_t. You could
perhaps use some other int types as characters, but will then run into
problems like having no string literals available.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk