Tools.h++ Manual
104011 Tandem Computers Incorporated 22-1
Templates 22
RWTBitVec<size>
Synopsis
#include <rw/tbitvec.h>
RWTBitVec<22> // A 22 bit long vector
RWTBitVec
<size> is a parameterized bit vector of fixed length size. Unlike
class
RWBitVec
, its length cannot be changed at run time. Its advantage of
RWBitVec
is its smaller size, and one less level of indirection, resulting in a
slight speed advantage.
Bits are numbered from 0 through size–1, inclusive.
The copy constructor and assignment operator use copy semantics.
Example In this example, a bit vector 24 bits long is exercised:
#include <rw/tbitvec.h>
main()
{
RWTBitVec<24> a, b; // Allocate two vectors.
a(2) = TRUE; // Set bit 2 (the third bit) of a on.
b(3) = TRUE; // Set bit 3 (the fourth bit) of b on.
RWTBitVec<24> c = a ^ b; // Set c to the XOR of a and b.
}