3 ms·
> This is a pretty standard data structure in most languages. Vectors are standard data structures. Append possibly mutating in place and possibly return a ne
by masklinn 7y ago
> This is a pretty standard data structure in most languages.
Vectors are standard data structures.
Append possibly mutating in place and possibly return a new vector instead, not so much.
That's exactly what Go does.
Not to mention the ability to share a backing array between two "vectors" and to append to both. That's a Go innovation right there.
- candiodari 7y ago> Not to mention the ability to share a backing array between two "vectors" and to append to both. That's a Go innovation right there. It's been pointed out in the comment right below this, but it is a bug if you do this. If the backing array has any free capacity the results will be very different from what you expect.