vector<bool> Class

The vector<bool> class is a partial specialization of vector for elements of type bool, with an allocator for the underlying type used by the specialization.

template<class Allocator> class vector< bool, allocator >

Remarks

This specialization class behaves like vector except for the differences provided in this article.

Operations dealing with the bool type correspond to values in the container storage; allocator_traits::construct is not used to construct these values.

Typedefs

const_pointer

A typedef to a const_iterator that can serve as a constant pointer to a Boolean element of the vector<bool>.

const_reference

A typedef for bool. After initialization, does not observe updates to the original value.

pointer

A typedef to an iterator that can serve as a pointer to a Boolean element of the vector<bool>.

Member Functions

flip

Reverses all bits in the vector<bool>.

swap

Exchanges the elements of two vector<bool>s with Boolean elements.

operator[]

Returns a simulated reference to the vector<bool> element at a specified position.

at

Functions identically to the unspecialized vector::at function except that it uses the proxy class vector<bool>::reference. See also operator[].

front

Functions identically to the unspecialized vector::front function except that it uses the proxy class vector<bool>::reference. See also operator[].

back

Functions identically to the unspecialized vector::back function except that it uses the proxy class vector<bool>::reference. See also operator[].

Proxy Class

vector<bool> reference Class

A class acting as a proxy to simulate bool& behavior, whose objects are able to provide references to elements (single bits) within a vector<bool> object.

Requirements

Header: <vector>

Namespace: std

See Also

Reference

Thread Safety in the Standard C++ Library

Standard Template Library