Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

5.3 Boolean Vectors

In the Standard C++ 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 DocumentContentsIndexNext file

OEM Edition, ©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.