Boost logo

Boost :

Subject: Re: [boost] Variadic append for std::string
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2017-01-25 17:55:13


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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk