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>

Inherits ghassanpl::detail::bit_num_base< VALUE_TYPE, BIT_NUM >.

Public Types

using base_type = detail::bit_num_base< VALUE_TYPE, BIT_NUM >
 

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_referenceoperator= (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
 
constexpr autointeger_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 164 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 = detail::bit_num_base<VALUE_TYPE, BIT_NUM>

Definition at line 166 of file bits.h.

Constructor & Destructor Documentation

◆ bit_reference() [1/2]

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

Definition at line 172 of file bits.h.

◆ bit_reference() [2/2]

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

Definition at line 180 of file bits.h.

Member Function Documentation

◆ bit_number()

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

Returns the bit number of the referenced bit.

Definition at line 216 of file bits.h.

◆ integer_value()

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

Return the value of the referenced variable.

Definition at line 213 of file bits.h.

◆ operator bool()

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

Definition at line 195 of file bits.h.

◆ operator=()

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

Definition at line 186 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>
constexpr bool ghassanpl::bit_reference< VALUE_TYPE, BIT_NUM >::operator== ( bit_reference< OTHER_VALUE_TYPE, OTHER_BIT_NUM > const other) const
inlineconstexprnoexcept

Definition at line 201 of file bits.h.

Member Data Documentation

◆ is_const

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

Definition at line 170 of file bits.h.

◆ is_static

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

Definition at line 169 of file bits.h.

◆ value_bit_count

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

Definition at line 167 of file bits.h.