Boost logo

Boost :

From: Mattias Flodin (flodin_at_[hidden])
Date: 2002-10-19 02:58:57


On Sat, Oct 19, 2002 at 12:01:01AM +0200, Michel André wrote:
> /// convert a wstring to a string
> std::string to_string(const std::wstring& str);
> std::string to_string(const wchar_t* str);
>
> /// convert a string to a wstring
> std::string to_wstring(const std::string& str);
> std::string to_wstring(const char* str);

These are very useful, but may be hard to make portable. But I guess you
could claim that as long as it works on all platforms that have a sense
of wide-character strings, it is portable.

In any case, shouldn't they be part of the operation of lexical_cast?.
I.e. lexical_cast<wstring>(string()) would perform the same function as
your to_wstring would.

-- 
Mattias Flodin <flodin_at_[hidden]>  -  http://www.cs.umu.se/~flodin/
Room NADV 102
Department of Computing Science
Umeå University
S-901 87 Umeå, Sweden
--
"Type in (cast) must be scalar; ANSI 3.3.4; page 39, lines 10-11 (I know
you don't care, I'm just trying to annoy you)"
  -- Error message from Apple's MPW C compiler

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk