nCine  2025.04.r498-9d36345
A cross-platform 2D game engine
Public Member Functions | Friends | List of all members
nctl::BitSet< T > Class Template Reference

A sequence of bits to be manipulated with logical operators. More...

#include <BitSet.h>

Public Member Functions

 BitSet (T value)
 
bool operator== (const BitSet &other) const
 
bool operator!= (const BitSet &other) const
 
bool test (unsigned int pos) const
 
bool all () const
 
bool any () const
 
bool none () const
 
unsigned int count () const
 
unsigned int size () const
 
BitSetoperator&= (const BitSet &other)
 
BitSetoperator|= (const BitSet &other)
 
BitSetoperator^= (const BitSet &other)
 
BitSet operator~ () const
 
BitSetoperator<<= (unsigned int pos)
 
BitSetoperator>>= (unsigned int pos)
 
BitSet operator<< (unsigned int pos) const
 
BitSet operator>> (unsigned int pos) const
 
void set ()
 Sets all bits in the bitset.
 
void set (unsigned int pos)
 Sets the bit at the specified position.
 
void set (unsigned int pos, bool value)
 Sets the bit at the specified position with the specified value.
 
void reset ()
 Resets all bits in the bitset.
 
void reset (unsigned int pos)
 Resets the bit at the specified position.
 
void flip (unsigned int pos)
 Flips the bit at the specified position.
 
unsigned int count () const
 
unsigned int count () const
 
unsigned int count () const
 
unsigned int count () const
 

Friends

BitSet operator& (const BitSet &lhs, const BitSet &rhs)
 
BitSet operator| (const BitSet &lhs, const BitSet &rhs)
 
BitSet operator^ (const BitSet &lhs, const BitSet &rhs)
 

Detailed Description

template<class T>
class nctl::BitSet< T >

A sequence of bits to be manipulated with logical operators.

Member Function Documentation

◆ all()

template<class T >
bool nctl::BitSet< T >::all
inline
Returns
True if all bits are set

◆ any()

template<class T >
bool nctl::BitSet< T >::any
inline
Returns
True if at least one bit is set

◆ count()

template<class T >
unsigned int nctl::BitSet< T >::count ( ) const
Returns
The number of bits that are set

◆ none()

template<class T >
bool nctl::BitSet< T >::none
inline
Returns
True if all bits are not set

◆ size()

template<class T >
unsigned int nctl::BitSet< T >::size
inline
Returns
The total number of bits in the bitset

◆ test()

template<class T >
bool nctl::BitSet< T >::test ( unsigned int  pos) const
inline
Returns
True if the bit at the specified position is set

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