Main Page   Reference Manual   Compound List   File List  

libecc::bitset_invertible< n, inverted > Class Template Reference

A bitset with a fixed number of bits, having possibly an infinite number of leading virtual 1's. More...

#include <libecc/bitset.h>

Inheritance diagram for libecc::bitset_invertible< n, inverted >:

Inheritance graph
[legend]
Collaboration diagram for libecc::bitset_invertible< n, inverted >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void base2_print_on (std::ostream &os) const
 Print bitset base 2.

bitset_digit_t digit (unsigned int d) const
 Access digit number d.


Detailed Description

template<unsigned int n, bool inverted>
class libecc::bitset_invertible< n, inverted >

A bitset with a fixed number of bits, having possibly an infinite number of leading virtual 1's.

When dealing with expressions, short bitsets are assumed to have leading zeros. This class however can represent an 'inverted' bitset, meaning that it has an infinite number of leading ones.

The use of this class should be restricted to (optimized out) temporaries in expressions like a = ~b; or a |= b & ~c. The user should not use this class directly.

See also:
libecc::operator~(bitset_invertible<n, inverted> const& bits)
Parameters:
n The number of bits in the bitset.
inverted True when each internal bit has the opposite meaning.


Member Function Documentation

template<unsigned int n, bool inverted>
void libecc::bitset_invertible< n, inverted >::base2_print_on std::ostream &  os  )  const
 

Print bitset base 2.

For debugging purposes.

For example (assuming you are using libcwd):

bitset<n> btst; Dout(dc::notice, cwprint_using(btst, &bitset::base2_print_on));

template<unsigned int n, bool inverted>
bitset_digit_t libecc::bitset_invertible< n, inverted >::digit unsigned int  d  )  const [inline]
 

Access digit number d.

Copyright © 2002-2004 Carlo Wood.  All rights reserved.