microfmt
Zero-allocation C++ formatting for constrained environments
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
microfmt::register_selected_field< State, Value, Selector, Registers > Struct Template Reference

Compile-time field trait with state-dependent member selection. More...

#include <register_context.hpp>

Public Types

using state_type = State
 
using value_type = Value
 

Static Public Member Functions

static constexpr bool matches (uint32_t index) noexcept
 
static constexpr const value_type * get (const state_type &state, uint32_t index) noexcept
 
static constexpr auto get (state_type &state, uint32_t index) noexcept -> decltype(Selector{}(state, index))
 

Detailed Description

template<typename State, typename Value, typename Selector, uint32_t... Registers>
struct microfmt::register_selected_field< State, Value, Selector, Registers >

Compile-time field trait with state-dependent member selection.

The selectors can inspect the complete source register set before returning the member that represents the requested register. This supports banked registers and ABI choices such as ARM frame pointer selection from CPSR.T.

Template Parameters
StateBound register structure.
ValueSelected register value type.
SelectorStateless function object returning a pointer into the state. A templated call operator can preserve the state's constness without separate const and mutable selector overloads. Returning only const value_type * makes the field read-only.
RegistersRegister indexes handled by the selectors.

Member Typedef Documentation

◆ state_type

template<typename State , typename Value , typename Selector , uint32_t... Registers>
using microfmt::register_selected_field< State, Value, Selector, Registers >::state_type = State

◆ value_type

template<typename State , typename Value , typename Selector , uint32_t... Registers>
using microfmt::register_selected_field< State, Value, Selector, Registers >::value_type = Value

Member Function Documentation

◆ get() [1/2]

template<typename State , typename Value , typename Selector , uint32_t... Registers>
static constexpr const value_type * microfmt::register_selected_field< State, Value, Selector, Registers >::get ( const state_type &  state,
uint32_t  index 
)
inlinestaticconstexprnoexcept

◆ get() [2/2]

template<typename State , typename Value , typename Selector , uint32_t... Registers>
static constexpr auto microfmt::register_selected_field< State, Value, Selector, Registers >::get ( state_type &  state,
uint32_t  index 
) -> decltype(Selector{}(state, index))
inlinestaticconstexprnoexcept

◆ matches()

template<typename State , typename Value , typename Selector , uint32_t... Registers>
static constexpr bool microfmt::register_selected_field< State, Value, Selector, Registers >::matches ( uint32_t  index)
inlinestaticconstexprnoexcept

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