Date: Wed, 4 Oct 2023 13:52:54 +0000
Prior to P2587 I'd say that the two main issues with using std::to_string are that better options are available in charconv; and the locale and other issues laid out in the paper. It seems that the adoption of the paper resolves both those issues.
I'd be in favor of keeping std::to_string around though. Primarily for a code semantic purpose - `auto x = std::to_string(1234)` is simple, readable, and tells you exactly what you're getting. Whereas `auto x = std::format("{}",1234)` is just one step detached and requires a little extra brainpower to process. And of course in the case of widestrings, the requirement to prepend your "{}" with an L only adds room for silly mistakes to be made.
There are also the possible concerns re code size and linking to all of format which have been previously mentioned.
I'd be in favor of keeping std::to_string around though. Primarily for a code semantic purpose - `auto x = std::to_string(1234)` is simple, readable, and tells you exactly what you're getting. Whereas `auto x = std::format("{}",1234)` is just one step detached and requires a little extra brainpower to process. And of course in the case of widestrings, the requirement to prepend your "{}" with an L only adds room for silly mistakes to be made.
There are also the possible concerns re code size and linking to all of format which have been previously mentioned.
Received on 2023-10-04 13:52:56