Why is 'unbounded_array' more efficient than 'vector'?
boost, c++, containers
Solution
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.
Problem
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?