codex
Loading...
Searching...
No Matches
codex::refl Namespace Reference

Namespaces

namespace  detail
 

Classes

class  SOA
 Transparently stores T objects as contiguous arrays of each field. More...
 

Typedefs

template<typename T >
using field_tuple_t = decltype(field_tuple(std::declval<T>()))
 Alias of the tuple type returned by field_tuple for type T.
 
template<std::size_t I>
using index_constant = std::integral_constant<std::size_t, I>
 Alias for an integral_constant of size_t.
 

Functions

template<typename T , std::size_t ... N>
constexpr std::size_t field_count (void)
 Number of fields in the struct T.
 
template<typename T , std::size_t ... N>
requires (requires { T{detail::to_any<N>{}...}; })
constexpr std::size_t field_count (void)
 Number of fields in the struct T.
 
template<typename T >
auto field_tuple (T &&t)
 Constructs a tuple of references to each field of T, in order.
 

Typedef Documentation

◆ field_tuple_t

template<typename T >
using codex::refl::field_tuple_t = decltype(field_tuple(std::declval<T>()))

Alias of the tuple type returned by field_tuple for type T.

◆ index_constant

template<std::size_t I>
using codex::refl::index_constant = std::integral_constant<std::size_t, I>

Alias for an integral_constant of size_t.

Function Documentation

◆ field_count() [1/2]

template<typename T , std::size_t ... N>
std::size_t codex::refl::field_count ( void )
constexpr

Number of fields in the struct T.

This is the specialization that is always instantiable. It is the converse of the requires clause in the other member of the overload set, i.e. struct T cannot be constructed with N fields. Because the search is done linearly from zero, the structure must have N - 1 fields.

Here is the caller graph for this function:

◆ field_count() [2/2]

template<typename T , std::size_t ... N>
requires (requires { T{detail::to_any<N>{}...}; })
std::size_t codex::refl::field_count ( void )
constexpr

Number of fields in the struct T.

Instantiable if it is possible to construct struct T with N fields. codex::refl::detail::to_any is used so that the types of the fields are disregarded. The requires clause will hold for values of N from zero to the number of fields in T.

Here is the call graph for this function:

◆ field_tuple()

template<typename T >
auto codex::refl::field_tuple ( T && t)

Constructs a tuple of references to each field of T, in order.

Here is the call graph for this function:
Here is the caller graph for this function: