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 >:
Collaboration diagram for libecc::bitset_invertible< N, inverted >:

List of all members.

Public Member Functions

void base2_print_on (std::ostream &os) const
 Print the bitset in binary form to os.
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 the bitset in binary form to os.

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));

References libecc::bitset_invertible< N, inverted >::digit().

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

Access digit number d.

Referenced by libecc::bitset_invertible< N, inverted >::base2_print_on().

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