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

#include <cpg_bitwise.hpp>

Collaboration diagram for cpg::bitwise::bit_pattern< T >:
[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 >
requires std::floating_point<S> || std::integral<S>
bit_patternoperator= (S s) noexcept
 
template<typename S >
requires std::floating_point<S> || std::integral<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<std::unsigned_integral T>
struct cpg::bitwise::bit_pattern< T >

Definition at line 378 of file cpg_bitwise.hpp.

Member Function Documentation

◆ lsb() [1/2]

template<std::unsigned_integral T>
const std::byte & cpg::bitwise::bit_pattern< T >::lsb ( ) const
inlinenoexcept

Definition at line 410 of file cpg_bitwise.hpp.

◆ lsb() [2/2]

template<std::unsigned_integral T>
std::byte & cpg::bitwise::bit_pattern< T >::lsb ( )
inlinenoexcept

Definition at line 416 of file cpg_bitwise.hpp.

◆ msb() [1/2]

template<std::unsigned_integral T>
const std::byte & cpg::bitwise::bit_pattern< T >::msb ( ) const
inlinenoexcept

Definition at line 398 of file cpg_bitwise.hpp.

◆ msb() [2/2]

template<std::unsigned_integral T>
std::byte & cpg::bitwise::bit_pattern< T >::msb ( )
inlinenoexcept

Definition at line 404 of file cpg_bitwise.hpp.

◆ operator S()

template<std::unsigned_integral T>
template<typename S >
requires std::floating_point<S> || std::integral<S>
cpg::bitwise::bit_pattern< T >::operator S ( ) const
inlinenoexcept

Definition at line 442 of file cpg_bitwise.hpp.

◆ operator=()

template<std::unsigned_integral T>
template<typename S >
requires std::floating_point<S> || std::integral<S>
bit_pattern & cpg::bitwise::bit_pattern< T >::operator= ( s)
inlinenoexcept

Definition at line 423 of file cpg_bitwise.hpp.

Member Data Documentation

◆ 

union { ... } cpg::bitwise::bit_pattern< T >::@1

◆ b

template<std::unsigned_integral T>
std::byte cpg::bitwise::bit_pattern< T >::b[byte_size]

Definition at line 394 of file cpg_bitwise.hpp.

◆ bit_size

template<std::unsigned_integral T>
constexpr size_t cpg::bitwise::bit_pattern< T >::bit_size = sizeof(T) * 8
staticconstexpr

Definition at line 386 of file cpg_bitwise.hpp.

◆ byte_size

template<std::unsigned_integral T>
constexpr size_t cpg::bitwise::bit_pattern< T >::byte_size = sizeof(T)
staticconstexpr

Definition at line 380 of file cpg_bitwise.hpp.

◆ max_limit

template<std::unsigned_integral T>
constexpr T cpg::bitwise::bit_pattern< T >::max_limit = std::numeric_limits<T>::max()
staticconstexpr

Definition at line 382 of file cpg_bitwise.hpp.

◆ min_limit

template<std::unsigned_integral T>
constexpr T cpg::bitwise::bit_pattern< T >::min_limit = std::numeric_limits<T>::min()
staticconstexpr

Definition at line 381 of file cpg_bitwise.hpp.

◆ n

template<std::unsigned_integral T>
T cpg::bitwise::bit_pattern< T >::n {}

Definition at line 391 of file cpg_bitwise.hpp.


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