ALib C++ Library
Library Version: 2402 R1
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 instances of this type 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 to define 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(TOmitInitialization) , 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 70 of file bitset.hpp.

#include <bitset.hpp>

Inner Type Index:

class  Reference
 
class  TBidiIterator
 

Public Type Index:

using ConstIterator = TBidiIterator<const TBitSet, false>
 
using ConstReverseIterator = TBidiIterator<const TBitSet, true>
 
using Iterator = TBidiIterator<TBitSet, false>
 
using ReverseIterator = TBidiIterator<TBitSet, true>
 
using TWord
 

Public Static Field Index:

static constexpr int Capacity
 
static constexpr int QtyWords
 

Public Method Index:

constexpr TBitSet () noexcept
 
constexpr TBitSet (bool preset) noexcept
 
constexpr TBitSet (const TOmitInitialization &) 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
 
template<typename... T>
constexpr TBitSetFlip (TInterface bit, T &&... args) 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
 
template<typename... T>
constexpr TBitSetReset (TInterface bit, T &&... args) noexcept
 
constexpr TBitSetSet () noexcept
 
template<typename... T>
constexpr TBitSetSet (TInterface bit, bool val) noexcept
 
template<typename... T>
constexpr TBitSetSet (TInterface bit, T &&... args) noexcept
 
constexpr bool Test (TInterface bit) 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 833 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 836 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 827 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 830 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:85
#define ATMP_IF_T_F( Cond, T, F)
Definition tmp.hpp:54
#define bitsof(type)
Definition bits.hpp:52

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 91 of file bitset.hpp.

Field Details:

◆ Capacity

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 85 of file bitset.hpp.

◆ QtyWords

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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:91

The size of the TWord array containing the bits

Definition at line 99 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 105 of file bitset.hpp.

Constructor(s) / Destructor Details::

◆ TBitSet() [1/4]

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

Default constructor initializing all bits to not set.

Definition at line 249 of file bitset.hpp.

Here is the call graph for this function:

◆ TBitSet() [2/4]

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

Constructor taking a dummy object. This constructor omits any value initialization and has to be called by providing TOmitInitialization() as the argument.

Definition at line 258 of file bitset.hpp.

◆ TBitSet() [3/4]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 264 of file bitset.hpp.

Here is the call graph for this function:

◆ TBitSet() [4/4]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 275 of file bitset.hpp.

Here is the call graph for this function:

Method Details:

◆ All()

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

Tests if any bit is set.

Returns
true if all bits are set, false otherwise.

Definition at line 372 of file bitset.hpp.

Here is the call graph for this function:

◆ Any()

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

Tests if any bit is set.

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

Definition at line 383 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 842 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 862 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 117 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 868 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 876 of file bitset.hpp.

◆ Count()

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

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

Returns
The number of bits counted.

Definition at line 361 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 892 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 896 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 846 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 872 of file bitset.hpp.

◆ Export() [1/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 425 of file bitset.hpp.

◆ Export() [2/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 416 of file bitset.hpp.

◆ Flip() [1/2]

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

Flips all bits from 0 to 1 and vice versa.

Returns
A reference to this object.

Definition at line 345 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>
constexpr TBitSet & Flip ( TInterface bit,
T &&... args )
inlineconstexprnoexcept

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

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

Definition at line 331 of file bitset.hpp.

Here is the call graph for this function:

◆ Import()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 453 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 139 of file bitset.hpp.

◆ 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 149 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 154 of file bitset.hpp.

◆ None()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 394 of file bitset.hpp.

Here is the call graph for this function:

◆ operator!=()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 489 of file bitset.hpp.

Here is the call graph for this function:

◆ operator&=()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 495 of file bitset.hpp.

◆ operator<<()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 586 of file bitset.hpp.

Here is the call graph for this function:

◆ operator<<=()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 592 of file bitset.hpp.

Here is the call graph for this function:

◆ operator==()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 476 of file bitset.hpp.

◆ operator>>()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 598 of file bitset.hpp.

Here is the call graph for this function:

◆ operator>>=()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 604 of file bitset.hpp.

Here is the call graph for this function:

◆ operator[]() [1/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 618 of file bitset.hpp.

◆ operator[]() [2/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 611 of file bitset.hpp.

◆ operator^=()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 505 of file bitset.hpp.

◆ operator|=()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 500 of file bitset.hpp.

◆ operator~()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 509 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 852 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 882 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 856 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 886 of file bitset.hpp.

◆ Reset() [1/2]

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

Sets all bits to 0.

Returns
A reference to this object.

Definition at line 343 of file bitset.hpp.

◆ Reset() [2/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
template<typename... T>
constexpr TBitSet & Reset ( TInterface bit,
T &&... args )
inlineconstexprnoexcept

Sets one or more bits to 0.

Parameters
bitThe index of the bit to clear.
argsAn optional continued list of indices of bits to clear.
Returns
A reference to this object.

Definition at line 317 of file bitset.hpp.

Here is the call graph for this function:

◆ Set() [1/3]

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

Sets all bits to 1.

Returns
A reference to this object.

Definition at line 341 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>
constexpr 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 290 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>
constexpr TBitSet & Set ( TInterface bit,
T &&... args )
inlineconstexprnoexcept

Sets one or more bits to 1.

Parameters
bitThe index of the bit to set.
argsAn optional continued list of indices of bits to set.
Returns
A reference to this object.

Definition at line 303 of file bitset.hpp.

Here is the call graph for this function:

◆ shiftLeft()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 523 of file bitset.hpp.

◆ shiftRight()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 555 of file bitset.hpp.

◆ Test()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 352 of file bitset.hpp.

Here is the call graph for this function:

◆ word() [1/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 133 of file bitset.hpp.

Here is the call graph for this function:

◆ word() [2/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
constexpr 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 128 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 111 of file bitset.hpp.


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