
Alexander Nasonov <alnsn <at> yandex.ru> writes:
I played with to_string_classic from
vault / Strings - Text Processing / string_convert.zip
It's faster then ostringstream but not much:
That is expected since the default implementation of to_string_classic use streams. Any speedup is due to my special stream implementation which avoids some memory allocations and string copies (20% faster is more than I expected) The idea behind the to_string_classic is that you can specialize it for common types. Something you can't do with e.g. lexical_cast since it uses the default locale. (The to_string_classic interface might need to be changed to allow specialization though, never tested it) You could also check the figures with the string_convert class where the stream is reused. string_convert conv<std::string>(std::locale::classic()); for(int i = 0; i < 10000000; ++i) x += conv.to_string(i)[i % 2]; Nice to know that my library works on both intel and gcc