regina::Tritmask1< T > Class Template Reference
Miscellaneous Utilities

A small but extremely fast "ternary bitmask" class that can store up to 8 * sizeof(T) "trits", each equal to 0, 1 or 2. More...

`#include <utilities/tritmask.h>`

## Public Member Functions

| Tritmask1 ()
| Creates a new tritmask with all trits set to 0. More...
| Tritmask1 (const Tritmask1< T > &cloneMe)
| Creates a clone of the given tritmask. More...
void | reset ()
| Sets all trits of this tritmask to 0. More...
Tritmask1< T > & | operator= (const Tritmask1< T > &other)
| Sets this tritmask to a copy of the given tritmask. More...
char | get (unsigned index) const
| Returns the value of the given trit in this tritmask. More...
void | set (unsigned index, char value)
| Sets the given trit of this tritmask to the given value. More...
bool | empty () const
| Determines whether this tritmask contains all zeroes. More...
bool | nonEmpty () const
| Determines whether this tritmask contains at least one non-zero trit. More...
bool | has2 () const
| Determines whether this tritmask contains at least one trit with value 2. More...
Tritmask1< T > & | minWith (const Tritmask1< T > &rhs)
| Sets this to the minimum of this and the given tritmask. More...
Tritmask1< T > & | maxWith (const Tritmask1< T > &rhs)
| Sets this to the maximum of this and the given tritmask. More...
Tritmask1< T > & | operator+= (const Tritmask1< T > &rhs)
| Sets this to the sum of this and the given tritmask. More...
Tritmask1< T > & | operator-= (const Tritmask1< T > &rhs)
| Sets this to the difference of this and the given tritmask. More...
bool | operator== (const Tritmask1< T > &other) const
| Determines whether this and the given tritmask are identical. More...

## Friends

std::ostream & | operator<< (std::ostream &out, const Tritmask1< T > &mask)
| Writes the given tritmask to the given output stream as a sequence of digits (0, 1 and/or 2). More...

## Detailed Description

### template<typename T>
class regina::Tritmask1< T >

A small but extremely fast "ternary bitmask" class that can store up to 8 * sizeof(T) "trits", each equal to 0, 1 or 2.

This tritmask packs all of the trits together into two variables of type T. This means that operations on tritmasks are extremely fast, because all of the trits can be processed in just a few native CPU operations.

The downside of course is that the number of trits that can be stored is limited to 8 * sizeof(T), where T must be a native unsigned integer type (such as unsigned char, unsigned int, or unsigned long long).

For another extremely fast tritmask class that can store twice as many trits, see Tritmask2. At present there is no tritmask class in Regina that can store arbitrarily many trits.

Precondition
  Type T is an unsigned integral numeric type.

Python:\n Not present.

The documentation for this class was generated from the following file:

- utilities/tritmask.h

Copyright © 1999-2016, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@maths.uq.edu.au).