Tools.h++ Manual
104011 Tandem Computers Incorporated 21-27
21
Public member functions
void clearBit(size_t i);
Clears (i.e., sets to
FALSE
) the bit with index
i
. The index
i
must be between
0 and the length of the vector less one. No bounds checking is performed. The
following are equivalent, although
clearBit(size_t)
is slightly smaller and
faster than using
operator()(size_t)
:
a(i) = FALSE;
a.clearBit(i);
const RWByte* data() const;
Returns a const pointer to the raw data of self. Should be used with care.
size_t firstFalse() const;
Returns the index of the first OFF (False) bit in self. Returns
RW_NPOS
if there
is no OFF bit.
size_t firstTrue() const;
Returns the index of the first ON (True) bit in self. Returns
RW_NPOS
if there is
no ON 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&)
.