Previous fileTop of DocumentContentsIndex pageNext file
Apache C++ Standard Library User's Guide

5.3 Boolean Vectors

In the C++ Standard Library, vectors of bit values (boolean 1/0 values) are handled as a special case, so that the values can be efficiently packed with several elements to a word. The operations for a boolean vector, vector<bool>, are a superset of those for an ordinary vector, only the implementation is more efficient.

One new member function added to the boolean vector datatype is flip(). When invoked, this function inverts all the bits of the vector. Boolean vectors also return as reference an internal value that also supports the flip() member function:

The vector<bool> also supports an additional swap() member function that allows swapping the values indicated by a pair of references:



Previous fileTop of DocumentContentsIndex pageNext file