It says here that
The unbounded array is similar to a
std::vector in that in can grow in
size beyond any fixed bound. However
unbounded_array is aimed at optimal
performance. Therefore unbounded_array
does not model a Sequence like
std::vector does.
What does this mean?
It appears to lack
insertanderasemethods. As these may be “slow,” ie their performance depends onsize()in thevectorimplementation, they were omitted to prevent the programmer from shooting himself in the foot.insertanderaseare required by the standard for a container to be called a Sequence, so unlikevector,unbounded_arrayis 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::capacityand always having the allocated block exactly the size of the content. This makes theunbounded_arrayobject smaller and makes the block on the heap exactly as big as it needs to be.