Tools.h++ Class Reference

Table Of Contents
Returns the index of the first FALSE bit in self. Returns RW_NPOS if there is no FALSE
bit.
size_t
firstTrue() const;
Returns the index of the first TRUE bit in self. Returns RW_NPOS if there is no TRUE
bit.
unsigned
hash() const;
Returns a value suitable for hashing.
RWBoolean
isEqual(const RWBitVec& v) const;
Returns TRUE if self and v have the same length and if each bit of self is set to the same
value as the corresponding bit in v. Otherwise, returns FALSE.
size_t
length() const;
Returns the number of bits in the vector.
ostream&
printOn(ostream& s) const;
Print the vector v on the output stream s. See the example above for a sample of the
format.
void
resize(size_t N);
Resizes the vector to have length N. If this results in a lengthening of the vector, the
additional bits will be set to FALSE.
istream&
scanFrom(istream&);
Read the bit vector from the input stream s. The vector will dynamically be resized as
necessary. The vector should be in the same format printed by member function
printOn(ostream&).
void
setBit(size_t i);
Sets (i.e., sets to TRUE) the bit with index i. The index i must be between 0 and size-1.
No bounds checking is performed. The following are equivalent, although setBit(size_t)
is slightly smaller and faster than using operator()(size_t):
a(i) = TRUE;
a.setBit(i);
RWBoolean