Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

RWTBitVec<size>

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Synopsis

#include <rw/tbitvec.h>
RWTBitVec<22>   // A 22 bit long vector

Description

RWTBitVec<size> is a parameterized bit vector of fixed length size. Unlike class RWBitVec, its length cannot be changed at run time. The advantage of RWTBitVec is its smaller size, and one less level of indirection, resulting in a slight speed advantage.

Bits are numbered from 0 through size-1, inclusive.

The copy constructor and assignment operator use copy semantics.

Persistence

None

Example

In this example, a bit vector 24 bits long is exercised:

#include <rw/tbitvec.h>
main()  {
  RWTBitVec<24> 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.
  RWTBitVec<24> c = a ^ b; // Set c to the XOR of a and b.

}

Public Constructors

RWTBitVec<size>();
RWTBitVec<size>(RWBoolean val);

Assignment Operators

RWTBitVec<size>&
operator=(const RWTBitVec<size>& v);
RWTBitVec&
operator=(RWBoolean val);
RWTBitVec&
operator&=(const RWTBitVec& v);
RWTBitVec&
operator^=(const RWTBitVec& v);
RWTBitVec&
operator|=(const RWTBitVec& v);
RWBitRef
operator[](size_t i);
RWBitRef
operator()(size_t i);

Logical Operators

RWBoolean
operator==(RWBoolean b) const;
RWBoolean
operator!=(RWBoolean b) const;
RWBoolean
operator==(const RWTBitVec& v) const;
RWBoolean
operator!=(const RWTBitVec& v) const;

Public Member Functions

void
clearBit(size_t i);
const RWByte*
data() const;
size_t
firstFalse() const;
size_t
firstTrue() const;
void
setBit(size_t i);
RWBoolean
testBit(size_t i) const;

Related Global Functions

RWTBitVec operator&(const RWTBitVec& v1, const RWTBitVec& v2);
RWTBitVec operator^(const RWTBitVec& v1, const RWTBitVec& v2);
RWTBitVec operator|(const RWTBitVec& v1, const RWTBitVec& v2);


Previous fileTop of documentContentsIndexNext file
©Copyright 1999, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.