vir-simd 0.4.189
Parallelism TS 2 extensions and simd fallback implementation
Loading...
Searching...
No Matches
struct_reflect.h File Reference

Tools for data member reflection of aggregates. More...

#include <utility>
#include <tuple>
#include <climits>

Go to the source code of this file.

Classes

struct  vir::as_tuple< T >
 Defines the member type type to a std::tuple specialization matching the non-static data members of T. More...
 
struct  vir::as_pair< T >
 Defines the member type type to a std::pair specialization matching the non-static data members of T. More...
 

Namespaces

namespace  vir
 This namespace collects libraries and tools authored by Matthias Kretz.
 

Concepts

concept  vir::reflectable_struct
 Satisfied if T can be used with the following functions and types.
 

Typedefs

template<std::size_t N, reflectable_struct T>
using vir::struct_element_t = std::remove_reference_t<decltype(struct_get<N>(std::declval<T &>()))>
 struct_element_t<N, T> is an alias for the type of the N -th non-static data member of T.
 
template<typename T>
using vir::as_tuple_t = typename as_tuple<T>::type
 Alias for a std::tuple specialization matching the non-static data members of T.
 
template<typename T>
using vir::as_pair_t = typename as_pair<T>::type
 Alias for a std::pair specialization matching the non-static data members of T.
 

Functions

template<std::size_t N, reflectable_struct T>
requires (N < struct_size_v<std::remove_cvref_t<T>>)
constexpr decltype(auto) vir::struct_get (T &&obj)
 Returns a cv-qualified reference to the N -th non-static data member in obj.
 
template<reflectable_struct T>
constexpr auto vir::to_tuple (T &&obj)
 Returns a std::tuple with a copy of all the non-static data members of obj.
 
template<reflectable_struct T>
constexpr auto vir::to_tuple_ref (T &&obj)
 Returns a std::tuple of lvalue references to all the non-static data members of obj.
 
template<typename T>
requires (struct_size_v<std::remove_cvref_t<T>> == 2)
constexpr auto vir::to_pair (T &&obj)
 Returns a std::pair with a copy of all the non-static data members of obj.
 
template<typename T>
requires (struct_size_v<std::remove_cvref_t<T>> == 2)
constexpr auto vir::to_pair_ref (T &&obj)
 Returns a std::pair of lvalue references to all the non-static data members of obj.
 

Variables

template<typename T>
constexpr std::size_t vir::struct_size_v = 0
 The number of non-static data members of T.
 

Detailed Description

Tools for data member reflection of aggregates.