ECSTASY
All in the name
Loading...
Searching...
No Matches
util::BitSet::Reference Class Reference

#include <BitSet.hpp>

Collaboration diagram for util::BitSet::Reference:

Public Member Functions

BIT_SET_CONSTEXPR Referenceoperator= (bool value) noexcept
 Assigns a value to the refenced bit.
 
BIT_SET_CONSTEXPR operator bool () const noexcept
 
BIT_SET_CONSTEXPR bool operator~ () const noexcept
 
BIT_SET_CONSTEXPR Referenceflip () noexcept
 Inverts the referenced bit.
 

Private Member Functions

constexpr Reference (BitSet &set, std::size_t pos)
 

Private Attributes

BitSet_set
 
std::size_t _pos
 
friend BitSet
 

Detailed Description

Definition at line 37 of file BitSet.hpp.

Constructor & Destructor Documentation

◆ Reference()

constexpr util::BitSet::Reference::Reference ( BitSet set,
std::size_t  pos 
)
inlineconstexprprivate

Definition at line 69 of file BitSet.hpp.

69 : _set(set), _pos(pos)
70 {
71 }

Member Function Documentation

◆ flip()

BIT_SET_CONSTEXPR Reference & util::BitSet::Reference::flip ( )
inlinenoexcept

Inverts the referenced bit.

Definition at line 59 of file BitSet.hpp.

60 {
61 *this = ~(*this);
62 return *this;
63 }

◆ operator bool()

BIT_SET_CONSTEXPR util::BitSet::Reference::operator bool ( ) const
inlinenoexcept
Returns
The value of the referenced bit.

Definition at line 47 of file BitSet.hpp.

48 {
49 return const_cast<BitSet const &>(this->_set)[this->_pos];
50 }

◆ operator=()

BIT_SET_CONSTEXPR Reference & util::BitSet::Reference::operator= ( bool  value)
inlinenoexcept

Assigns a value to the refenced bit.

Definition at line 40 of file BitSet.hpp.

41 {
42 this->_set.set(this->_pos, value);
43 return *this;
44 }
BIT_SET_CONSTEXPR BitSet & set(std::size_t pos, bool value=true) noexcept
Definition BitSet.hpp:111

◆ operator~()

BIT_SET_CONSTEXPR bool util::BitSet::Reference::operator~ ( ) const
inlinenoexcept
Returns
The inverse of the referenced bit.

Definition at line 53 of file BitSet.hpp.

54 {
55 return !bool(*this);
56 }

Member Data Documentation

◆ _pos

std::size_t util::BitSet::Reference::_pos
private

Definition at line 67 of file BitSet.hpp.

◆ _set

BitSet& util::BitSet::Reference::_set
private

Definition at line 66 of file BitSet.hpp.

◆ BitSet

friend util::BitSet::Reference::BitSet
private

Definition at line 73 of file BitSet.hpp.


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