Boost logo

Boost :

Subject: Re: [boost] Variadic append for std::string
From: Christof Donat (cd_at_[hidden])
Date: 2017-01-26 04:06:47


Am 25.01.2017 23:50, schrieb Gavin Lambert:
> On 26/01/2017 06:44, Christof Donat wrote:
>>> If you have size(), it means you know the size because the conversion
>>> work has already been done.
>> I think, it is fine, if it returns a reasonable upper bound, like e.g.
>> 4
>> for a 16 bit value in hex representation. It is just meant, to make
>> sure, that we can allocate enough memory upfront, and avoid calls to
>> realloc().
> Perhaps spell it as capacity() instead, to indicate the *possible*
> (worst-case) output size of the factory.
> It's not exactly the same as the meaning in containers, but it's close
> enough that people would understand it better, I think.
> max_size() is another possibility.

I like max_size().


Boost list run by bdawes at, gregod at, cpdaniel at, john at