It appears to lack insert
and erase
methods. As these may be "slow," ie their performance depends on size()
in the vector
implementation, they were omitted to prevent the programmer from shooting himself in the foot.
insert
and erase
are required by the standard for a container to be called a Sequence, so unlike vector
, unbounded_array
is not a sequence.
No efficiency is gained by failing to be a sequence, per se.
However, it is more efficient in its memory allocation scheme, by avoiding a concept of vector::capacity
and always having the allocated block exactly the size of the content. This makes the unbounded_array
object smaller and makes the block on the heap exactly as big as it needs to be.