26 Jan
2017
26 Jan
'17
9:06 a.m.
Hi, 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(). Christof