Tools.h++ Manual

104011 Tandem Computers Incorporated 23-3
23
Logical assignments. Set each element of self to the logical AND, XOR, or OR,
respectively, of self and the corresponding bit in
v
.
Indexing operators
RWBitRef operator[](size_t i);
Returns a reference to the i'th bit of self. This reference can be used as an
lvalue. The index
i
must be between 0 and
size–1
, inclusive. Bounds
checking will occur.
RWBitRef operator()(size_t i);
Returns a reference to the i'th bit of self. This reference can be used as an
lvalue. The index
i
must be between
0
and
size–1
, inclusive. No bounds
checking is done.
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 size–1. 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.
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 testBit(size_t i) const;
Tests 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
testBit(size_t)
is slightly smaller and faster than using
operator()(size_t)
:
if( a(i) ) doSomething();
if( a.testBit(i) ) doSomething();