Simple bit vector.
More...
|
| utility |
| unresizable vector whose size is known at compile time, which may be allocated on the stack, and which indexes from 1.
|
|
Simple bit vector.
- Author
- Stuart G. Mentzer (Stuar.nosp@m.t_Me.nosp@m.ntzer.nosp@m.@obj.nosp@m.exx.c.nosp@m.om)
- Note
- Wraps std::vector<bool> with a more convenient interface for bit fields
- Bits not in vector are considered false
- Bit type must be convertible to vector::size_type: making this a template arg allows the use of classes with private conversion to an integral type that make BitVector a friend
- Stores a vector<bool> of the bits
- Faster but less space efficient than BitSet for sparse sets (mostly false bits)
- Bits are the index of the bits in the vector
- There must be a way to generate a BitVector from 2 Bits to construct a BitVector with more than 5 Bits, such as: inline utility::BitVector< Bit > operator |( Bit const & i, Bit const & j ) { return utility::BitVector< Bit >( i, j ); }
- Construction with more than 5 Bits can be done most efficiently as BitVector< Bit >( i | j |= k |= l ) assuming an operator| is defined as above: the use of |= instead of | after the first | avoids generating additional BitVector temporaries