Boost logo

Boost :

From: Olaf van der Spek (olafvdspek_at_[hidden])
Date: 2006-04-15 06:58:48


On 4/15/06, Reece Dunn <msclrhd_at_[hidden]> wrote:
> What about converting to different string types, mainly std::string or std::wstring?
>
> I am also working on implementing to_string and string_to :). Maybe we could combine our efforts and get to_string/string_to into Boost.
>
> At the moment, my versions don't have locale support and string_to isn't returning optional<T>, although I am working on it. They can be used like this:
>
> print( boost::to_string< char >( 10 )); // returns std::string
> print( boost::to_string< char >( 10.01 ));
> print( boost::to_string< wchar_t >( 10 )); // returns std::wstring
> print( boost::to_string< wchar_t >( 10.01 ));

The template parameter doesn't look nice (IMO).
What about to_basic_string<T> and to_string as alias for
to_basic_string<char> and to_wstring as alias for
to_basic_string<wchat_t>?

But then you're still limited to basic_string. Can't you make one that
can use other containers?


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