header_utils
Loading...
Searching...
No Matches
ghassanpl::bit_reference< VALUE_TYPE, BIT_NUM > Struct Template Reference

Models a reference to a specific bit in a variable. Can be a statically-defined bit number (BIT_NUM != dynamic_bit_number). More...

#include <bits.h>

Public Types

using base_type

Public Member Functions

constexpr bit_reference (VALUE_TYPE &ref, size_t bitnum)
constexpr bit_reference (VALUE_TYPE &ref, detail::bit_num_t< BIT_NUM >={}) noexcept
constexpr bit_reference & operator= (bool val) noexcept
constexpr operator bool () const noexcept
template<bit_integral OTHER_VALUE_TYPE, size_t OTHER_BIT_NUM>
constexpr bool operator== (bit_reference< OTHER_VALUE_TYPE, OTHER_BIT_NUM > const &other) const noexcept
template<bit_integral OTHER_VALUE_TYPE, size_t OTHER_BIT_NUM>
constexpr auto operator<=> (bit_reference< OTHER_VALUE_TYPE, OTHER_BIT_NUM > const &other) const noexcept
constexpr auto & integer_value () const noexcept
 Return the value of the referenced variable.
constexpr size_t bit_number () const noexcept
 Returns the bit number of the referenced bit.

Static Public Attributes

static constexpr size_t value_bit_count
static constexpr bool is_static
static constexpr bool is_const

Detailed Description

template<bit_integral VALUE_TYPE, size_t BIT_NUM = dynamic_bit_number>
struct ghassanpl::bit_reference< VALUE_TYPE, BIT_NUM >

Models a reference to a specific bit in a variable. Can be a statically-defined bit number (BIT_NUM != dynamic_bit_number).

Definition at line 309 of file bits.h.

Member Typedef Documentation

◆ base_type

template<bit_integral VALUE_TYPE, size_t BIT_NUM = dynamic_bit_number>
using ghassanpl::bit_reference< VALUE_TYPE, BIT_NUM >::base_type

Definition at line 311 of file bits.h.

Constructor & Destructor Documentation

◆ bit_reference() [1/2]

template<bit_integral VALUE_TYPE, size_t BIT_NUM = dynamic_bit_number>
ghassanpl::bit_reference< VALUE_TYPE, BIT_NUM >::bit_reference ( VALUE_TYPE & ref,
size_t bitnum )
inlineconstexpr

Definition at line 317 of file bits.h.

◆ bit_reference() [2/2]

template<bit_integral VALUE_TYPE, size_t BIT_NUM = dynamic_bit_number>
ghassanpl::bit_reference< VALUE_TYPE, BIT_NUM >::bit_reference ( VALUE_TYPE & ref,
detail::bit_num_t< BIT_NUM > = {} )
inlineconstexprnoexcept

Definition at line 325 of file bits.h.

Member Function Documentation

◆ bit_number()

template<bit_integral VALUE_TYPE, size_t BIT_NUM = dynamic_bit_number>
size_t ghassanpl::bit_reference< VALUE_TYPE, BIT_NUM >::bit_number ( ) const
inlinenodiscardconstexprnoexcept

Returns the bit number of the referenced bit.

Definition at line 361 of file bits.h.

◆ integer_value()

template<bit_integral VALUE_TYPE, size_t BIT_NUM = dynamic_bit_number>
auto & ghassanpl::bit_reference< VALUE_TYPE, BIT_NUM >::integer_value ( ) const
inlinenodiscardconstexprnoexcept

Return the value of the referenced variable.

Definition at line 358 of file bits.h.

◆ operator bool()

template<bit_integral VALUE_TYPE, size_t BIT_NUM = dynamic_bit_number>
ghassanpl::bit_reference< VALUE_TYPE, BIT_NUM >::operator bool ( ) const
inlineexplicitnodiscardconstexprnoexcept

Definition at line 340 of file bits.h.

◆ operator<=>()

template<bit_integral VALUE_TYPE, size_t BIT_NUM = dynamic_bit_number>
template<bit_integral OTHER_VALUE_TYPE, size_t OTHER_BIT_NUM>
auto ghassanpl::bit_reference< VALUE_TYPE, BIT_NUM >::operator<=> ( bit_reference< OTHER_VALUE_TYPE, OTHER_BIT_NUM > const & other) const
inlinenodiscardconstexprnoexcept

Definition at line 352 of file bits.h.

◆ operator=()

template<bit_integral VALUE_TYPE, size_t BIT_NUM = dynamic_bit_number>
bit_reference & ghassanpl::bit_reference< VALUE_TYPE, BIT_NUM >::operator= ( bool val)
inlineconstexprnoexcept

Definition at line 331 of file bits.h.

◆ operator==()

template<bit_integral VALUE_TYPE, size_t BIT_NUM = dynamic_bit_number>
template<bit_integral OTHER_VALUE_TYPE, size_t OTHER_BIT_NUM>
bool ghassanpl::bit_reference< VALUE_TYPE, BIT_NUM >::operator== ( bit_reference< OTHER_VALUE_TYPE, OTHER_BIT_NUM > const & other) const
inlinenodiscardconstexprnoexcept

Definition at line 346 of file bits.h.

Member Data Documentation

◆ is_const

template<bit_integral VALUE_TYPE, size_t BIT_NUM = dynamic_bit_number>
bool ghassanpl::bit_reference< VALUE_TYPE, BIT_NUM >::is_const
staticconstexpr

Definition at line 315 of file bits.h.

◆ is_static

template<bit_integral VALUE_TYPE, size_t BIT_NUM = dynamic_bit_number>
bool ghassanpl::bit_reference< VALUE_TYPE, BIT_NUM >::is_static
staticconstexpr

Definition at line 314 of file bits.h.

◆ value_bit_count

template<bit_integral VALUE_TYPE, size_t BIT_NUM = dynamic_bit_number>
size_t ghassanpl::bit_reference< VALUE_TYPE, BIT_NUM >::value_bit_count
staticconstexpr

Definition at line 312 of file bits.h.