Boost logo

Boost :

Subject: Re: [boost] to_string(v)
From: Olaf van der Spek (ml_at_[hidden])
Date: 2011-09-29 15:02:55


On Thu, Sep 29, 2011 at 6:46 PM, Antony Polukhin <antoshkka_at_[hidden]> wrote:
> 2011/9/29 Olaf van der Spek <ml_at_[hidden]>:
>> Some time ago (2002) there was talk about a to_string function. Did
>> this ever materialize?
>
> Functions to_string and to_wstring are part of the upcoming C++0x
> standard. However, there is no to_u16string and to_u32string.

But they're not in Boost?
Unfortunately I can't use C++11 in some projects for quite some time.

>> "to_string(5)" is a lot shorter than "lexical_cast<std::string>(5)".
>>
>> Likewise for "to_int("5")".
>
> As for me, it is easier to remember one function lexical_cast, than
> tens of of them: stoi, stoll, stof, to_string, to_wstring, stod...
> Also, it is hard to use those functions in generic programming.

Not every function is a generic function.

Olaf


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