Hi All,
I am trying to find the fastest way to convert integer directly to char* (C-string) without converting it to std::string first. I have already tried using std::to_string() function but then also i need to convert it into C-string using c_str() function. Basically an alternative for itoa in c++ for version 11.
Please feel free to give your views regarding this.
Thanks and Regards
Pulkit Jain
How about std::to_chars in C++17?
Also, why do you need to convert to
char*
instead of usingstd::string
s? It seems unnecessary unless you need to squeeze every bit of performance in your code.Yes actually, I want to save some nanoseconds. Will to_chars work fine with C++11
Auto comment: topic has been updated by pulkitjain (previous revision, new revision, compare).
You can use sprintf
Thanks