Lightweight 0.20260617.0
Loading...
Searching...
No Matches
Lightweight::RecordMemberList< MemberPointers > Struct Template Reference

Compile-time list of a record's members, stored as pointers-to-member. More...

#include <Description.hpp>

Public Types

template<std::size_t I>
using TypeAt = detail::MemberPointee< std::tuple_element_t< I, std::tuple< decltype(MemberPointers)... > > >::type
 

Static Public Member Functions

template<typename Record , typename Callable >
static constexpr void EnumerateValues (Record &record, Callable &&callable)
 
template<typename Callable >
static constexpr void EnumerateTypes (Callable &&callable)
 Invokes callable<I, MemberType>() for every member, in order.
 
template<typename ElementMask , typename Record , typename Callable >
static constexpr void EnumerateMaskedValues (Record &record, Callable &&callable)
 
template<std::size_t I, typename Record >
static constexpr decltype(auto) MemberAt (Record &record)
 Returns a reference to the member at index I of record.
 

Static Public Attributes

static constexpr std::size_t Count = sizeof...(MemberPointers)
 Number of members in the list.
 

Detailed Description

template<auto... MemberPointers>
struct Lightweight::RecordMemberList< MemberPointers >

Compile-time list of a record's members, stored as pointers-to-member.

This is the access vehicle used by Description. It is an empty type — the members are carried as non-type template parameters — so it is far cheaper to parse and instantiate than a std::tuple of heterogeneous pointer values (no class storage, no CTAD). Member types are recovered by indexing the pointer-to-member pack (see TypeAt) and iteration uses element-wise pack expansion, both of which are essentially free at compile time.

Definition at line 38 of file Description.hpp.

Member Typedef Documentation

◆ TypeAt

template<auto... MemberPointers>
template<std::size_t I>
using Lightweight::RecordMemberList< MemberPointers >::TypeAt = detail::MemberPointee<std::tuple_element_t<I, std::tuple<decltype(MemberPointers)...> >>::type

The (unwrapped) type of the member at index I.

Indexes the pointer-to-member pack via std::tuple_element_t rather than the __type_pack_element builtin: the latter is a Clang/GCC extension that MSVC does not accept as a type (it parses the bare identifier as a function template — error C7568).

Definition at line 49 of file Description.hpp.

Member Function Documentation

◆ EnumerateValues()

template<auto... MemberPointers>
template<typename Record , typename Callable >
static constexpr void Lightweight::RecordMemberList< MemberPointers >::EnumerateValues ( Record &  record,
Callable &&  callable 
)
inlinestaticconstexpr

Invokes callable<I>(record.member_I) for every member, in order.

The callable is forwarded once into a named reference and then invoked for each member, so a mutable visitor (e.g. one carrying a running column offset) keeps its state across members.

Definition at line 56 of file Description.hpp.

◆ EnumerateTypes()

template<auto... MemberPointers>
template<typename Callable >
static constexpr void Lightweight::RecordMemberList< MemberPointers >::EnumerateTypes ( Callable &&  callable)
inlinestaticconstexpr

Invokes callable<I, MemberType>() for every member, in order.

Definition at line 71 of file Description.hpp.

◆ EnumerateMaskedValues()

template<auto... MemberPointers>
template<typename ElementMask , typename Record , typename Callable >
static constexpr void Lightweight::RecordMemberList< MemberPointers >::EnumerateMaskedValues ( Record &  record,
Callable &&  callable 
)
inlinestaticconstexpr

Invokes callable<I>(record.member_I) for the members whose indices appear in ElementMask (a std::integer_sequence<std::size_t, ...>), in mask order. Backs partial-column queries.

Definition at line 82 of file Description.hpp.

◆ MemberAt()

template<auto... MemberPointers>
template<std::size_t I, typename Record >
static constexpr decltype(auto) Lightweight::RecordMemberList< MemberPointers >::MemberAt ( Record &  record)
inlinestaticconstexpr

Returns a reference to the member at index I of record.

Definition at line 92 of file Description.hpp.

Member Data Documentation

◆ Count

template<auto... MemberPointers>
constexpr std::size_t Lightweight::RecordMemberList< MemberPointers >::Count = sizeof...(MemberPointers)
staticconstexpr

Number of members in the list.

Definition at line 41 of file Description.hpp.


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