On 6/15/12 10:18 AM, Konstantin Tokarev wrote:
> 
> 
> 15.06.2012, 17:50, "Giuseppe D'Angelo" <dange...@gmail.com>:
>> On 15 June 2012 14:35, Sven Anderson <sven.ander...@snom.com> wrote:
>>
>>>  On 15.06.2012 14:58, Thiago Macieira wrote:
>>>>  Any one care to give me the Standard Library equivalent of:
>>>>
>>>>        QString::number(x)
>>>  string to_string(int) ?
>>
>> No go, C++11 only.
> 
> #if NO_CXX11_AVAILABLE
> std::string to_string(int x)
> {
>     std::static_cast<std::ostringstream*>( &(std::ostringstream() << x ) 
> )->str();
> }
> #endif
> 

It works, but it's terribly slow: sprintf is 5 times faster on my
system. Benchmark is at https://gist.github.com/2937802.

Chhers,
Jonas

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to