Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

5.3 Boolean Vectors

vectors of bit values (boolean 1/0 values) are handled as a special case by the Standard C++ Library, 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
©Copyright 1998, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.
OEM Release, June 1998