boost::dynamic_bitset::reserve

Informs the bitset of a planned change in size, so that it can manage the storage allocation accordingly.

Synopsis

Declared in <boost/dynamic_bitset/dynamic_bitset.hpp>

void
reserve(size_type num_bits);

Description

After reserve(), capacity() is greater or equal to the argument of reserve() if reallocation happens; and equal to the previous value of capacity() otherwise. Reallocation happens at this point if and only if the current capacity is less than the argument of reserve().

Type requirements

If AllocatorOrContainer is a container, it provides reserve().

Note

It does not change the size of the bitset.

Throws

An allocation error if memory is exhausted (std::bad_alloc if allocator_type is a std::allocator). If the number of blocks needed exceeds the max_size() of the underlying container, whatever that container throws in that case (std::length_error for a std::vector).

Parameters

Name

Description

num_bits

The number of bits the bitset should be able to store without reallocation.

Created with MrDocs