Subject: Re: [boost] [lexical_cast] char types and UDTs
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2012-04-12 12:14:51
2012/4/12 Mathias Gaunard <mathias.gaunard_at_[hidden]>:
> On 12/04/12 14:24, Antony Polukhin wrote:
>> Current implementation is simple, and user only required to provide stream
>> operators<< and>> to work with it.
> Yes, but apparently, that doesn't work with user-defined wide string types.
> Having to implement three traits that each must provide conversion
> facilities to all of char*, wchar_t*, char16_t* and char32_t* seems a bit
> Surely there must be a simpler solution.
First (and simpliest) solution is: leave everything as is. If
lexical_cast fails - use wstream.
Second solution: allow user to specialize stream_char<>.
Other solutions will add much more complications, introduce ugly
Specializing stream_char<> does not solve all the problems. Noexcept
version of lexical cast, fast user defined conversions are still
There is one more solution: determinate stream_char<>::type for
UserType using lots of meta-programming. For that solution following
Is there any ideas, how that can be done in a *portable* way?
-- Best regards, Antony Polukhin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk