
25 Jan
2017
25 Jan
'17
5:44 p.m.
Hi, Am 25.01.2017 18:37, schrieb Richard Hodges:
The string factories, of course need more than only begin() and end(). They also have to provide a way to estimate the size of the output, because we want to be able to allocate the complete buffer upfront. In the naive implementation I called that size().
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(). Christof