|
Boost : |
Subject: Re: [boost] Variadic append for std::string
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2017-01-25 17:50:58
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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk