template<typename
T, size_t N>
class auto_vec< T, N >
Space efficient vector. These vectors can grow dynamically and are
allocated together with their control data. They are suited to be
included in data structures. Prior to initial allocation, they
only take a single word of storage.
These vectors are implemented as a pointer to an embeddable vector.
The semantics allow for this pointer to be NULL to represent empty
vectors. This way, empty vectors occupy minimal space in the
structure containing them.
Properties:
- The whole vector and control data are allocated in a single
contiguous block.
- The whole vector may be re-allocated.
- Vector data may grow and shrink.
- Access and manipulation requires a pointer test and
indirection.
- It requires 1 word of storage (prior to vector allocation).
Limitations:
These vectors must be PODs because they are stored in unions.
(http://en.wikipedia.org/wiki/Plain_old_data_structures).
As long as we use C++03, we cannot have constructors nor
destructors in classes that are stored in unions.
auto_vec is a subclass of vec that automatically manages creating and
releasing the internal vector. If N is non zero then it has N elements of
internal storage. The default is no internal storage, and you probably only
want to ask for internal storage for vectors on the stack because if the
size of the vector is larger than the internal storage that space is wasted.