Tools.h++ Class Reference

Table Of Contents
Example
In this example, a bit vector 24 bits long is declared and exercised:
#include "rw/gbitvec.h"
#include <iostream.h>
const int VECSIZE = 8;
declare(RWGBitVec, VECSIZE) // declare a 24 bit long vector
implement(RWGBitVec, VECSIZE) // implement the vector
main()
{
RWGBitVec(VECSIZE) 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.
RWGBitVec(VECSIZE) c = a ^ b; // Set c to the XOR of a and b.
cout << "Vector 1" << "\t" << "Vector 2" << "\t"
<< "Vector 1 xor Vector 2" << endl;
for(int i = 0; i < VECSIZE; i++)
cout << a[i] << "\t\t" << b[i] << "\t\t" << c[i] << endl;
return 0;
}
Public Constructors
RWGBitVec(size)();
Construct a bit vector size elements long, with all bits initialized to FALSE.
RWGBitVec(size)(RWBoolean f);
Construct a bit vector size elements long, with all bits initialized to f.
Assignment Operators
RWGBitVec(sz)&
operator=(const RWGBitVec(sz)& v);
Set each element of self to the corresponding bit value of v. Return a reference to self.
RWGBitVec(sz)&
operator=(RWBoolean f);