ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
TBitSet< TInterface, TEnd, TBegin > Class Template Reference

Description:

template<typename TInterface, TInterface TEnd, TInterface TBegin = 0>
class alib::lang::TBitSet< TInterface, TEnd, TBegin >

This class is an improved replica of std::bitset and hence stores and exposes a set of bits. The differences (advantages) of this class to the standard type are:

  • The class provides an efficient bidirectional iterator, which uses intrinsics (on supported platforms, via functions CLZ and CTZ) to search the next bit set without looping over unset bits.
  • The size of this type's instances is adjusted to the next fitting integral size, namely char, short, int, long and long long. If even larger bitsets are requested, the size becomes a multiple of the size of long long.
  • The type denoting a bit-index used in the interface methods can optionally be altered from int to a custom type which is statically castable to int, by providing specifying template parameter TInterface accordingly. This avoids the need for statically casting the index type with every invocation of an interface method.
    The main motivation for providing this was to allow to address bits with enumeration elements.
  • Instead of one template parameter defining the fixed size of the bitset, two parameters TBegin and TEnd are provided. This allows defining bitsets of a range of indices that do not start with 0 and in this case avoids the need for subtraction of the (fixed) start value of a range with every invocation of an interface method.
  • Methods Set and Reset allow to pass several bit indices at once using a comma-separated list.
  • With methods std::bitset<N>::to_ulong() / to_ullong(), the standard type allows the export of the internal value only to 64-bit values (on common platforms). If the higher bits are to be exported, the bitset has to be shifted, which is inefficient and destructive (a copy has to be taken).
    This implementation provides method Export, which - dependent on the size of the bitset - offers an additional index to address any higher word. Furthermore, for smaller bitsets the export method returns a fitting smaller integral.
  • Explicit uninitialized construction is possíble with TBitSet::TBitSet(const std::nullptr_t&), which avoids code and run-time penalty, in cases where the bits are to be initialized at a later stage.

In respect to performance, this type equals a typical implementation std::bitset.

See also
  • Type definition EnumBitSet, which defines a bitset over ALib Iterable Enums based on this type.
  • For a quick tutorial on the use of this type (in nice combination with C++ enumerations), see chapter 3.5 Using Class TBitSet with Iterable Enums of the Programmer's Manual of module ALib Enums.
  • Type definition BitSet in namespace alib, which defines a set with interface-type int.
  • Class BitBuffer, which implements a sort of stream buffer to store bits in dynamic memory.
Template Parameters
TInterfaceThe interface type to denote bit position values. This type has to be statically castable to and constructible from int.
TEndThe last index of the interface type plus 1.
TBeginThe first index of the interface type. (Defaults to 0.)

Definition at line 69 of file bitset.hpp.

#include <bitset.hpp>

Inner Type Index:

class  Reference
 
class  TBidiIterator
 

Public Type Index:

using ConstIterator = TBidiIterator<const TBitSet, false>
 The constant iterator type.
 
using ConstReverseIterator = TBidiIterator<const TBitSet, true>
 Same as ConstIterator, but working from the end to the start of the TBitSet.
 
using Iterator = TBidiIterator<TBitSet, false>
 
using ReverseIterator = TBidiIterator<TBitSet, true>
 Same as Iterator, but working from the end to the start of the TBitSet.
 
using TWord
 

Public Static Field Index:

static constexpr int Capacity
 
static constexpr int QtyWords
 The size of the TWord array containing the bits.
 

Public Method Index:

constexpr TBitSet () noexcept
 Default constructor initializing all bits to not set.
 
constexpr TBitSet (bool preset) noexcept
 
constexpr TBitSet (const std::nullptr_t &) noexcept
 
constexpr TBitSet (TWord preset) noexcept
 
constexpr bool All () const noexcept
 
constexpr bool Any () const noexcept
 
Iterator begin (int skip=0)
 
ConstIterator begin (int skip=0) const
 
ConstIterator cbegin (int skip=0) const
 
ConstIterator cend () const
 
constexpr int Count () const noexcept
 
ConstReverseIterator crbegin (int skip=0) const
 
ConstReverseIterator crend () const
 
Iterator end ()
 
ConstIterator end () const
 
constexpr const TWordExport (int wordIdx) const noexcept
 
constexpr TWordExport (int wordIdx) noexcept
 
constexpr TBitSetFlip () noexcept
 Flips all bits from 0 to 1 and vice versa.
 
template<typename... T>
constexpr TBitSetFlip (TInterface firstBit, T &&... furtherBits) noexcept
 
constexpr TWordImport (TWord val, int wordIdx) noexcept
 
constexpr bool None () const noexcept
 
constexpr bool operator!= (const TBitSet &rhs) const noexcept
 
constexpr TBitSetoperator&= (const TBitSet &rhs) noexcept
 
constexpr TBitSet operator<< (int cnt) const noexcept
 
constexpr TBitSetoperator<<= (int cnt) noexcept
 
constexpr bool operator== (const TBitSet &rhs) const noexcept
 
constexpr TBitSet operator>> (int cnt) const noexcept
 
constexpr TBitSetoperator>>= (int cnt) noexcept
 
constexpr const Reference< const TBitSetoperator[] (int bit) const noexcept
 
constexpr Reference< TBitSetoperator[] (TInterface bit) noexcept
 
constexpr TBitSetoperator^= (const TBitSet &rhs) noexcept
 
constexpr TBitSetoperator|= (const TBitSet &rhs) noexcept
 
constexpr TBitSet operator~ () const noexcept
 
ReverseIterator rbegin (int skip=0)
 
ConstReverseIterator rbegin (int skip=0) const
 
ReverseIterator rend ()
 
ConstReverseIterator rend () const
 
constexpr TBitSetReset () noexcept
 Sets all bits to 0.
 
template<typename... T>
constexpr TBitSetReset (TInterface firstBit, T &&... furtherBits) noexcept
 
constexpr TBitSetSet () noexcept
 Sets all bits to 1.
 
template<typename... T>
constexpr TBitSetSet (TInterface bit, bool val) noexcept
 
template<typename... T>
constexpr TBitSetSet (TInterface firstBit, T &&... furtherBits) noexcept
 
constexpr bool Test (TInterface bit) noexcept
 

Protected Static Method Index:

static constexpr int bitIdx (TInterface b) noexcept
 
static constexpr TWord mask (int wIdx) noexcept
 
static constexpr TWord mask0010 (TInterface b) noexcept
 
static constexpr TWord mask1101 (TInterface b) noexcept
 
static constexpr int wordIdx (TInterface b) noexcept
 

Protected Field Index:

TWord words [QtyWords ? QtyWords :1]
 

Protected Method Index:

constexpr void shiftLeft (int cnt, TBitSet &target) const noexcept
 
constexpr void shiftRight (int cnt, TBitSet &target) const noexcept
 
constexpr const TWordword (TInterface b) const noexcept
 
constexpr TWordword (TInterface b) noexcept
 

Type Definition Details:

◆ ConstIterator

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
using ConstIterator = TBidiIterator<const TBitSet, false>

The constant iterator type.

Definition at line 828 of file bitset.hpp.

◆ ConstReverseIterator

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
using ConstReverseIterator = TBidiIterator<const TBitSet, true>

Same as ConstIterator, but working from the end to the start of the TBitSet.

Definition at line 831 of file bitset.hpp.

◆ Iterator

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
using Iterator = TBidiIterator<TBitSet, false>

Iterator type, implementing the standard library concept of RandomAccessIterator .

Definition at line 822 of file bitset.hpp.

◆ ReverseIterator

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
using ReverseIterator = TBidiIterator<TBitSet, true>

Same as Iterator, but working from the end to the start of the TBitSet.

Definition at line 825 of file bitset.hpp.

◆ TWord

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
using TWord
Initial value:
ATMP_IF_T_F( (Capacity > bitsof(long) ), unsigned long long,
ATMP_IF_T_F( (Capacity > bitsof(int) ), unsigned long ,
ATMP_IF_T_F( (Capacity > bitsof(short) ), unsigned int ,
ATMP_IF_T_F( (Capacity > bitsof(char) ), unsigned short ,
unsigned char ))))
static constexpr int Capacity
Definition bitset.hpp:84
#define ATMP_IF_T_F( Cond, T, F)
Definition tmp.hpp:50
#define bitsof(type)
Definition bits.hpp:49

The type that is used to store the bits in. TMP code chooses the smallest fitting integral. If Capacity exceeds type long long, an array of long long, field QtyWords will become greater than 1.

Definition at line 90 of file bitset.hpp.

Field Details:

◆ Capacity

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
int Capacity
staticconstexpr
Initial value:
= static_cast<int>( TEnd )
- static_cast<int>( TBegin )

The number of bits in the range resulting from template parameters TBegin and TEnd.

Definition at line 84 of file bitset.hpp.

◆ QtyWords

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
int QtyWords
staticconstexpr
Initial value:
+ ( (Capacity % bitsof(TWord)) != 0 ? 1 : 0 )
ATMP_IF_T_F((Capacity > bitsof(long)), unsigned long long, ATMP_IF_T_F((Capacity > bitsof(int)), unsigned long, ATMP_IF_T_F((Capacity > bitsof(short)), unsigned int, ATMP_IF_T_F((Capacity > bitsof(char)), unsigned short, unsigned char)))) TWord
Definition bitset.hpp:90

The size of the TWord array containing the bits.

Definition at line 98 of file bitset.hpp.

◆ words

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
TWord words[QtyWords ? QtyWords :1]
protected

The array of integrals containing the bits needed. The unused upper bits in the last word are always kept 0.

Definition at line 104 of file bitset.hpp.

Constructor(s) / Destructor Details:

◆ TBitSet() [1/4]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
TBitSet ( )
inlineconstexprnoexcept

Default constructor initializing all bits to not set.

Definition at line 248 of file bitset.hpp.

Here is the call graph for this function:

◆ TBitSet() [2/4]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
TBitSet ( const std::nullptr_t & )
inlineconstexprnoexcept

Constructor taking a tag-type. This constructor omits any value initialization and has to be called by providing nullptr as the argument.

Definition at line 256 of file bitset.hpp.

◆ TBitSet() [3/4]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
TBitSet ( TWord preset)
inlineconstexprnoexcept

Constructor which takes an external TWord which initializes the first word. If constexpr field QtyWords is greater than 1, the other bits are set to 0 and can be set using method Import or of course using other interface methods.

Parameters
presetThe preset value for the bits.

Definition at line 262 of file bitset.hpp.

Here is the call graph for this function:

◆ TBitSet() [4/4]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
TBitSet ( bool preset)
inlineconstexprnoexcept

Constructor which takes an external TWord which initializes the first word. If constexpr field QtyWords is greater than 1, the other bits are set to 0 and can be set using method Import or of course using other interface methods.

Parameters
presetThe preset value for the bits.

Definition at line 273 of file bitset.hpp.

Here is the call graph for this function:

Method Details:

◆ All()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
bool All ( ) const
inlineconstexprnoexcept

Tests if any bit is set.

Returns
true if all bits are set, false otherwise.

Definition at line 370 of file bitset.hpp.

Here is the call graph for this function:

◆ Any()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
bool Any ( ) const
inlineconstexprnoexcept

Tests if any bit is set.

Returns
true if at least one bit is set, false otherwise.

Definition at line 381 of file bitset.hpp.

◆ begin() [1/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
Iterator begin ( int skip = 0)
inline

Returns an iterator pointing to the first (lowest) bit set.

Parameters
skipDefaults to 0. If set, denotes the amount of bits which are not examined at the beginning of the iteration. Must not be negative.
Returns
The start iterator. In case no bit is set, the same as end.

Definition at line 837 of file bitset.hpp.

◆ begin() [2/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
ConstIterator begin ( int skip = 0) const
inline

Returns a const iterator pointing to the first (lowest) bit set.

Parameters
skipDefaults to 0. If set, denotes the amount of bits which are not examined at the beginning of the iteration. Must not be negative.
Returns
The start iterator. In case no bit is set, the same as end.

Definition at line 857 of file bitset.hpp.

◆ bitIdx()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
static constexpr int bitIdx ( TInterface b)
inlinestaticconstexprprotectednoexcept

Helper to determine the bit index in the actual word.

Parameters
bThe absolute index.
Returns
The relative index.

Definition at line 116 of file bitset.hpp.

◆ cbegin()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
ConstIterator cbegin ( int skip = 0) const
inline

Returns a const iterator pointing to the first (lowest) bit set.

Parameters
skipDefaults to 0. If set, denotes the amount of bits which are not examined at the beginning of the iteration. Must not be negative.
Returns
The start iterator. In case no bit is set, the same as end.

Definition at line 863 of file bitset.hpp.

◆ cend()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
ConstIterator cend ( ) const
inline

Returns a const iterator pointing to the non-existing bit behind the highest one.

Returns
The end iterator.

Definition at line 871 of file bitset.hpp.

◆ Count()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
int Count ( ) const
inlineconstexprnoexcept

Returns the number of bits set to true in this set.

Returns
The number of bits counted.

Definition at line 359 of file bitset.hpp.

Here is the call graph for this function:

◆ crbegin()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
ConstReverseIterator crbegin ( int skip = 0) const
inline

Returns a const reverse iterator pointing to the last (highest) bit set.

Parameters
skipDefaults to 0. If set, denotes the amount of bits which are not examined at the beginning of the iteration. Must not be negative.
Returns
The reverse iteration start.

Definition at line 887 of file bitset.hpp.

◆ crend()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
ConstReverseIterator crend ( ) const
inline

Returns a const iterator pointing to the non-existing bit before the lowest one.

Returns
The reverse iteratation end.

Definition at line 891 of file bitset.hpp.

◆ end() [1/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
Iterator end ( )
inline

Returns an iterator pointing to the non-existing bit behind the highest one.

Returns
The end iterator.

Definition at line 841 of file bitset.hpp.

◆ end() [2/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
ConstIterator end ( ) const
inline

Returns a const iterator pointing to the non-existing bit behind the highest one.

Returns
The end iterator.

Definition at line 867 of file bitset.hpp.

◆ Export() [1/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
const TWord & Export ( int wordIdx) const
inlineconstexprnoexcept

Const version of Export.

Parameters
wordIdxThe subset of bits to receive.
ATTENTION: See non-constant variant Export on this parameter!
Returns
A reference to the inner word.

Definition at line 421 of file bitset.hpp.

◆ Export() [2/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
TWord & Export ( int wordIdx)
inlineconstexprnoexcept

Exports the internal integral(s) holding the bits.

Attention
Other than this documentation suggests, parameter wordIdx is only available if the bitset size (defined by template parameters TBegin and TEnd) exceeds the number of bits in the widest possible TWord-type, hence the size of sizeof(long long) * 8. In that case, field QtyWords provides the number of words that are exportable.
This maxiumum word size is 64-bit on common platforms. Here, 0 adresses bits 0..63, 1 bits 64..127 and so forth.
Parameters
wordIdxThe subset of bits to receive.
Returns
A reference to the inner word.

Definition at line 413 of file bitset.hpp.

◆ Flip() [1/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
TBitSet & Flip ( )
inlineconstexprnoexcept

Flips all bits from 0 to 1 and vice versa.

Returns
A reference to this object.

Definition at line 343 of file bitset.hpp.

Here is the call graph for this function:

◆ Flip() [2/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
template<typename... T>
TBitSet & Flip ( TInterface firstBit,
T &&... furtherBits )
inlineconstexprnoexcept

Flips one or more bits from 0 to 1 and vice versa.

Parameters
firstBitThe index of the bit to flip.
furtherBitsAn optional continued list of indices of bits to flip.
Returns
A reference to this object.

Definition at line 329 of file bitset.hpp.

Here is the call graph for this function:

◆ Import()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
TWord & Import ( TWord val,
int wordIdx )
inlineconstexprnoexcept

Imports the data from (a) given integral(s).

Attention
Other than this documentation suggests, parameter wordIdx is only available if the bitset size (defined by template parameters TBegin and TEnd) exceeds the number of bits in the widest possible TWord-type, hence the size of sizeof(long long) * 8. In that case, field QtyWords provides the number of words that are importable.
This maxiumum word size is 64-bit on common platforms. Here, 0 adresses bits 0..63, 1 bits 64..127 and so forth.
Parameters
valThe value to import.
wordIdxThe subset of bits to overwrite.
Returns
A reference to the inner word.

Definition at line 448 of file bitset.hpp.

◆ mask()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
static constexpr TWord mask ( int wIdx)
inlinestaticconstexprprotectednoexcept

Returns a bitmask with all used bits set.

Parameters
wIdxThe index of the word in array words.
Returns
A bitmask with all bits set for indices smaller than QtyWords -1, and a mask that covers the remaining bits if wIdx targets the last word.

Definition at line 138 of file bitset.hpp.

Here is the call graph for this function:

◆ mask0010()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
static constexpr TWord mask0010 ( TInterface b)
inlinestaticconstexprprotectednoexcept

Returns a bitmask with only the given bit set.

Parameters
bThe index of the bit to set.
Returns
A bitmask with one bit set.

Definition at line 148 of file bitset.hpp.

Here is the call graph for this function:

◆ mask1101()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
static constexpr TWord mask1101 ( TInterface b)
inlinestaticconstexprprotectednoexcept

Returns a bitmask with only the given bit unset.

Parameters
bThe index of the bit to unset.
Returns
A bitmask with all but one bit set.

Definition at line 153 of file bitset.hpp.

◆ None()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
bool None ( ) const
inlineconstexprnoexcept

Tests if not any bit is set.

Returns
false if at least one bit is set, true otherwise.

Definition at line 392 of file bitset.hpp.

Here is the call graph for this function:

◆ operator!=()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
bool operator!= ( const TBitSet< TInterface, TEnd, TBegin > & rhs) const
inlineconstexprnoexcept

Compares this bitset with another bitset of equal size.
(Available with C++ versions below 20. Afterwards synthesized.

Parameters
rhsThe other TBitSet to compare this with.
Returns
false if all bits are equal, true otherwise.

Definition at line 484 of file bitset.hpp.

Here is the call graph for this function:

◆ operator&=()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
TBitSet & operator&= ( const TBitSet< TInterface, TEnd, TBegin > & rhs)
inlineconstexprnoexcept

Sets the bits to the result of binary AND on corresponding pairs of bits of this and other.

Parameters
rhsThe other TBitSet to compare this with.
Returns
A reference to this object.

Definition at line 490 of file bitset.hpp.

◆ operator<<()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
TBitSet operator<< ( int cnt) const
inlineconstexprnoexcept

Returns a temporary copy of this with a shift to the left (towards higher index positions).

Parameters
cntThe number of positions to shift.
Returns
A copy of this with shifted bits.

Definition at line 581 of file bitset.hpp.

Here is the call graph for this function:

◆ operator<<=()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
TBitSet & operator<<= ( int cnt)
inlineconstexprnoexcept

Shifts the bits of this object to the left left (towards higher index positions).

Parameters
cntThe number of positions to shift.
Returns
A reference to this object.

Definition at line 587 of file bitset.hpp.

Here is the call graph for this function:

◆ operator==()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
bool operator== ( const TBitSet< TInterface, TEnd, TBegin > & rhs) const
inlineconstexprnoexcept

Compares this bitset with another bitset of equal size.

Parameters
rhsThe other TBitSet to compare this with.
Returns
true if all bits are equal, false otherwise.

Definition at line 471 of file bitset.hpp.

◆ operator>>()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
TBitSet operator>> ( int cnt) const
inlineconstexprnoexcept

Returns a temporary copy of this with a shift to the right (towards lower index positions).

Parameters
cntThe number of positions to shift.
Returns
A copy of this with shifted bits.

Definition at line 593 of file bitset.hpp.

Here is the call graph for this function:

◆ operator>>=()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
TBitSet & operator>>= ( int cnt)
inlineconstexprnoexcept

Shifts the bits of this object to the left right (towards lower index positions).

Parameters
cntThe number of positions to shift.
Returns
A reference to this object.

Definition at line 599 of file bitset.hpp.

Here is the call graph for this function:

◆ operator[]() [1/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
const Reference< const TBitSet > operator[] ( int bit) const
inlineconstexprnoexcept

Returns a const reference to a specific bit.

Parameters
bitThe bit to create a reference for.
Returns
A reference to the bit in this object.

Definition at line 613 of file bitset.hpp.

◆ operator[]() [2/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
Reference< TBitSet > operator[] ( TInterface bit)
inlineconstexprnoexcept

Returns a reference to a specific bit.

Parameters
bitThe bit to create a reference for.
Returns
A reference to the bit in this object.

Definition at line 606 of file bitset.hpp.

◆ operator^=()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
TBitSet & operator^= ( const TBitSet< TInterface, TEnd, TBegin > & rhs)
inlineconstexprnoexcept

Sets the bits to the result of binary XOR on corresponding pairs of bits of this and other.

Parameters
rhsThe other TBitSet to compare this with.
Returns
A reference to this object.

Definition at line 500 of file bitset.hpp.

◆ operator|=()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
TBitSet & operator|= ( const TBitSet< TInterface, TEnd, TBegin > & rhs)
inlineconstexprnoexcept

Sets the bits to the result of binary OR on corresponding pairs of bits of this and other.

Parameters
rhsThe other TBitSet to compare this with.
Returns
A reference to this object.

Definition at line 495 of file bitset.hpp.

◆ operator~()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
TBitSet operator~ ( ) const
inlineconstexprnoexcept

Returns a temporary copy of this with all bits flipped (binary NOT)..

Returns
A copy of this with flipped bits.

Definition at line 504 of file bitset.hpp.

Here is the call graph for this function:

◆ rbegin() [1/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
ReverseIterator rbegin ( int skip = 0)
inline

Returns a reverse iterator pointing to the last (highest) bit set.

Parameters
skipDefaults to 0. If set, denotes the amount of bits which are not examined at the beginning of the iteration. Must not be negative.
Returns
The reverse iteration start.

Definition at line 847 of file bitset.hpp.

◆ rbegin() [2/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
ConstReverseIterator rbegin ( int skip = 0) const
inline

Returns a const reverse iterator pointing to the last (highest) bit set.

Parameters
skipDefaults to 0. If set, denotes the amount of bits which are not examined at the beginning of the iteration. Must not be negative.
Returns
The reverse iteration start.

Definition at line 877 of file bitset.hpp.

◆ rend() [1/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
ReverseIterator rend ( )
inline

Returns an iterator pointing to the non-existing bit before the lowest one.

Returns
The reverse iteratation end.

Definition at line 851 of file bitset.hpp.

◆ rend() [2/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
ConstReverseIterator rend ( ) const
inline

Returns a const iterator pointing to the non-existing bit before the lowest one.

Returns
The reverse iteratation end.

Definition at line 881 of file bitset.hpp.

◆ Reset() [1/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
TBitSet & Reset ( )
inlineconstexprnoexcept

Sets all bits to 0.

Returns
A reference to this object.

Definition at line 341 of file bitset.hpp.

◆ Reset() [2/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
template<typename... T>
TBitSet & Reset ( TInterface firstBit,
T &&... furtherBits )
inlineconstexprnoexcept

Sets one or more bits to 0.

Parameters
firstBitThe index of the first bit to clear.
furtherBitsAn optional continued list of bit-indices.
Returns
A reference to this object.

Definition at line 315 of file bitset.hpp.

Here is the call graph for this function:

◆ Set() [1/3]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
TBitSet & Set ( )
inlineconstexprnoexcept

Sets all bits to 1.

Returns
A reference to this object.

Definition at line 339 of file bitset.hpp.

Here is the call graph for this function:

◆ Set() [2/3]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
template<typename... T>
TBitSet & Set ( TInterface bit,
bool val )
inlineconstexprnoexcept

Sets the bit to 1.

Parameters
bitThe index of the bit to set.
valtrue or false to set or clear bit bit.
Returns
A reference to this object.

Definition at line 288 of file bitset.hpp.

Here is the call graph for this function:

◆ Set() [3/3]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
template<typename... T>
TBitSet & Set ( TInterface firstBit,
T &&... furtherBits )
inlineconstexprnoexcept

Sets one or more bits to 1.

Parameters
firstBitThe index of the first bit to set.
furtherBitsAn optional continued list of bit-indices.
Returns
A reference to this object.

Definition at line 301 of file bitset.hpp.

Here is the call graph for this function:

◆ shiftLeft()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
void shiftLeft ( int cnt,
TBitSet< TInterface, TEnd, TBegin > & target ) const
inlineconstexprprotectednoexcept

Stores a shifted result in target. This protected method is accessible via operator<<() (which creates and returns a temporary target) and operator<<=(), which passes this to parameter target.

Parameters
cntThe number of positions to shift.
targetThe target object.

Definition at line 518 of file bitset.hpp.

Here is the call graph for this function:

◆ shiftRight()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
void shiftRight ( int cnt,
TBitSet< TInterface, TEnd, TBegin > & target ) const
inlineconstexprprotectednoexcept

Stores a shifted result in target. This protected method is accessible via operator>>() (which creates and returns a temporary target) and operator>>=(), which passes this to parameter target.

Parameters
cntThe number of positions to shift.
targetThe target object.

Definition at line 550 of file bitset.hpp.

Here is the call graph for this function:

◆ Test()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
bool Test ( TInterface bit)
inlineconstexprnoexcept

Returns true if the bit is set, false otherwise.

Parameters
bitDenotes the bit to test.
Returns
The state of the bit.

Definition at line 350 of file bitset.hpp.

Here is the call graph for this function:

◆ word() [1/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
const TWord & word ( TInterface b) const
inlineconstexprprotectednoexcept

Helper receive a const reference word from the array of words.

Parameters
bThe bit to address index.
Returns
A reference to the word.

Definition at line 132 of file bitset.hpp.

Here is the call graph for this function:

◆ word() [2/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
TWord & word ( TInterface b)
inlineconstexprprotectednoexcept

Helper receive the word from the array of words.

Parameters
bThe bit to address index.
Returns
A reference to the word.

Definition at line 127 of file bitset.hpp.

Here is the call graph for this function:

◆ wordIdx()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
static constexpr int wordIdx ( TInterface b)
inlinestaticconstexprprotectednoexcept

Helper to determine the bit index in the actual word.

Parameters
bThe absolute index.
Returns
The word index.

Definition at line 110 of file bitset.hpp.


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