25 Jan
2017
25 Jan
'17
10:55 p.m.
On 26/01/2017 05:23, Christof Donat wrote:
to_string(x) is better than x.str() is better than implicit conversion.
Maybe it is just my strong distaste of the name to_string(), which at the moment is just a feeling, no good reasons. It just feels clumsy to me, while .str() is in line with regular expression matches, and stringstreams in the standard library.
Clumsy or not, it's in the standard now. [1] str() is shorter, of course. I don't see any particular reason why you can't provide all of them, though (even the implicit conversion), as different things are going to feel more natural to different people, particularly in different contexts. [1] http://en.cppreference.com/w/cpp/string/basic_string/to_string