C++ Library Extensions 2022.12.09
To help learn modern C++ programming
tpf::bitwise::bit_pattern< T, typename > Struct Template Reference

#include <tpf_bitwise.hpp>

Collaboration diagram for tpf::bitwise::bit_pattern< T, typename >:
[legend]

Public Member Functions

const std::byte & msb () const noexcept
 
std::byte & msb () noexcept
 
const std::byte & lsb () const noexcept
 
std::byte & lsb () noexcept
 
template<typename S , typename = tpf::types::enable_if_numerical_number_t<S>>
bit_patternoperator= (S s) noexcept
 
template<typename S , typename = tpf::types::enable_if_numerical_number_t<S>>
 operator S () const noexcept
 

Public Attributes

union {
   T   n {}
 
   std::byte   b [byte_size]
 
}; 
 

Static Public Attributes

static constexpr size_t byte_size = sizeof(T)
 
static constexpr T min_limit = std::numeric_limits<T>::min()
 
static constexpr T max_limit = std::numeric_limits<T>::max()
 
static constexpr size_t bit_size = sizeof(T) * 8
 

Detailed Description

template<typename T, typename = tpf::types::enable_if_unsigned_integral_t<T>>
struct tpf::bitwise::bit_pattern< T, typename >

Definition at line 344 of file tpf_bitwise.hpp.

Member Function Documentation

◆ lsb() [1/2]

template<typename T , typename = tpf::types::enable_if_unsigned_integral_t<T>>
const std::byte & tpf::bitwise::bit_pattern< T, typename >::lsb ( ) const
inlinenoexcept

Definition at line 376 of file tpf_bitwise.hpp.

◆ lsb() [2/2]

template<typename T , typename = tpf::types::enable_if_unsigned_integral_t<T>>
std::byte & tpf::bitwise::bit_pattern< T, typename >::lsb ( )
inlinenoexcept

Definition at line 382 of file tpf_bitwise.hpp.

◆ msb() [1/2]

template<typename T , typename = tpf::types::enable_if_unsigned_integral_t<T>>
const std::byte & tpf::bitwise::bit_pattern< T, typename >::msb ( ) const
inlinenoexcept

Definition at line 364 of file tpf_bitwise.hpp.

◆ msb() [2/2]

template<typename T , typename = tpf::types::enable_if_unsigned_integral_t<T>>
std::byte & tpf::bitwise::bit_pattern< T, typename >::msb ( )
inlinenoexcept

Definition at line 370 of file tpf_bitwise.hpp.

◆ operator S()

template<typename T , typename = tpf::types::enable_if_unsigned_integral_t<T>>
template<typename S , typename = tpf::types::enable_if_numerical_number_t<S>>
tpf::bitwise::bit_pattern< T, typename >::operator S ( ) const
inlinenoexcept

Definition at line 406 of file tpf_bitwise.hpp.

◆ operator=()

template<typename T , typename = tpf::types::enable_if_unsigned_integral_t<T>>
template<typename S , typename = tpf::types::enable_if_numerical_number_t<S>>
bit_pattern & tpf::bitwise::bit_pattern< T, typename >::operator= ( s)
inlinenoexcept

Definition at line 388 of file tpf_bitwise.hpp.

Member Data Documentation

◆ 

union { ... } tpf::bitwise::bit_pattern< T, typename >::@5

◆ b

template<typename T , typename = tpf::types::enable_if_unsigned_integral_t<T>>
std::byte tpf::bitwise::bit_pattern< T, typename >::b[byte_size]

Definition at line 360 of file tpf_bitwise.hpp.

◆ bit_size

template<typename T , typename = tpf::types::enable_if_unsigned_integral_t<T>>
constexpr size_t tpf::bitwise::bit_pattern< T, typename >::bit_size = sizeof(T) * 8
staticconstexpr

Definition at line 352 of file tpf_bitwise.hpp.

◆ byte_size

template<typename T , typename = tpf::types::enable_if_unsigned_integral_t<T>>
constexpr size_t tpf::bitwise::bit_pattern< T, typename >::byte_size = sizeof(T)
staticconstexpr

Definition at line 346 of file tpf_bitwise.hpp.

◆ max_limit

template<typename T , typename = tpf::types::enable_if_unsigned_integral_t<T>>
constexpr T tpf::bitwise::bit_pattern< T, typename >::max_limit = std::numeric_limits<T>::max()
staticconstexpr

Definition at line 348 of file tpf_bitwise.hpp.

◆ min_limit

template<typename T , typename = tpf::types::enable_if_unsigned_integral_t<T>>
constexpr T tpf::bitwise::bit_pattern< T, typename >::min_limit = std::numeric_limits<T>::min()
staticconstexpr

Definition at line 347 of file tpf_bitwise.hpp.

◆ n

template<typename T , typename = tpf::types::enable_if_unsigned_integral_t<T>>
T tpf::bitwise::bit_pattern< T, typename >::n {}

Definition at line 357 of file tpf_bitwise.hpp.


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