Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Extended functionality

Default initialization for vector-like containers

STL and most other containers value initialize new elements in common operations like vector::resize(size_type n) or explicit vector::vector(size_type n).

In some performance-sensitive environments, where vectors are used as a replacement for variable-size buffers for file or network operations, value initialization is a cost that is not negligible as elements are going to be overwritten by an external source shortly after new elements are added to the container.

Boost.Container offers two new members for vector, static_vector and stable_vector: explicit container::container(size_type n, default_init_t) and explicit container::resize(size_type n, default_init_t), where new elements are constructed using default initialization.