Closed juliusl closed 2 months ago
What did you confuse the length with? I know that there is a common mistake where people incorrectly assume that with_capacity
returns a value with a non-zero length, but that doesn't seem to be the case you ran into.
I've opened #714 to try to make the docs a bit more specific.
What did you confuse the length with? I know that there is a common mistake where people incorrectly assume that
with_capacity
returns a value with a non-zero length, but that doesn't seem to be the case you ran into.
I was expecting the same behavior as with_capacity
and new
initially and I'm okay that it's not the same behavior but thinking it would be nice if it were more obvious.
Thanks @paolobarbolini !
It would be great if the doc header included a note:
It's easy to miss that the argument is
len
which corresponds to the actuallen
, was scratching my head a bunch until I added sanity checks to discover this.