Tools.h++ Class Reference

Table Of Contents
main(){
// Allocate a vector with 20 bits, set to TRUE:
RWBitVec av(20, TRUE);
av(2) = FALSE; // Turn bit 2 off
av.clearBit(7); // Turn bit 7 off
av.setBit(2); // Turn bit 2 back on
for(int i=11; i<=14; i++) av(i) = FALSE;
cout << av << endl; // Print the vector out
}
Program output:
[
1 1 1 1 1 1 1 0 1 1 1 0 0 0 0 1 1 1 1 1
]
Public Constructors
RWBitVec();
Construct a zero lengthed (null) vector.
RWBitVec(size_t N);
Construct a vector with N bits. The initial value of the bits is undefined.
RWBitVec(size_t N, RWBoolean initVal);
Construct a vector with N bits, each set to the Boolean value initVal.
RWBitVec(const RWByte* bp, size_t N);
Construct a vector with N bits, initialized to the data in the array of bytes pointed to by
bp. This array must be at least long enough to contain N bits. The identifier RWByte is a
typedef for an unsigned char.
RWBitVec(const RWBitVec& v);
Copy constructor. Uses value semantics -- the constructed vector will be a copy of v.
~RWBitVec();
The destructor. Releases any allocated memory.