refl-cpp
refl::trait Namespace Reference

Provides type-level operations for refl-cpp related use-cases. More...

Classes

struct  append
 Appends a type to the list. More...
 
struct  as_tuple< T< Ts... > >
 Provides a member typedef which is a std::tuple specialization with template type parameters equivalent to the type parameters of the provided type. More...
 
struct  as_type_list< T< Ts... > >
 Provides a member typedef type which is a type_list with template type parameters equivalent to the type parameters of the provided type. More...
 
struct  concat
 Concatenates N lists together. More...
 
struct  contains< T, type_list< Ts... > >
 Checks whether T is contained in the list of types. More...
 
struct  contains_base< T, type_list< Ts... > >
 Checks whether a type deriving from T is contained in the list of types. More...
 
struct  contains_instance< T, type_list< Ts... > >
 Checks whether an instance of the template T is contained in the list of types. More...
 
struct  filter< Predicate, type_list< Ts... > >
 Filters a type_list according to a predicate template. More...
 
struct  get< N, type_list< Ts... > >
 Provides a member typedef type which is the N-th type in the provided type_list. More...
 
struct  index_of< T, type_list< Ts... > >
 The index of the type in the type list, -1 if it doesn't exist. More...
 
struct  index_of_base< T, type_list< Ts... > >
 The index of the type in the type list that is derived from T, -1 if it doesn't exist. More...
 
struct  index_of_instance< T, type_list< Ts... > >
 The index of the type in the type list that is a template instance of T, -1 if it doesn't exist. More...
 
struct  is_container
 Checks whether objects of the type T support member .begin() and .end() operations. More...
 
struct  is_descriptor
 A trait for detecting whether the type 'T' is a refl-cpp descriptor. More...
 
struct  is_field
 A trait for detecting whether the type 'T' is a field descriptor. More...
 
struct  is_function
 A trait for detecting whether the type 'T' is a function descriptor. More...
 
struct  is_instance
 Detects whether T is a template specialization. More...
 
struct  is_instance_of
 Detects whther the type U is a template specialization of T. More...
 
struct  is_member
 A trait for detecting whether the type 'T' is a member descriptor. More...
 
struct  is_property
 Checks whether T is marked as a property. More...
 
struct  is_proxy
 
struct  is_reflectable
 Checks whether there is reflection metadata for the type T. More...
 
struct  is_type
 Detects whether the type T is a type_descriptor. More...
 
struct  map< Mapper, type_list< Ts... > >
 Transforms a type_list according to a predicate template. More...
 
struct  prepend
 Prepends a type to the list. More...
 
struct  remove_qualifiers
 Removes all reference and cv-qualifiers from T. More...
 
struct  reverse
 Reverses a list of types. More...
 
struct  skip< N, type_list< Ts... > >
 Skips the first N types in the provided type_list. More...
 
struct  unique
 Creates a new list containing the repeating elements in the source list only once. More...
 

Typedefs

template<typename T >
using remove_qualifiers_t = typename remove_qualifiers< T >::type
 Removes all reference and cv-qualifiers from T. More...
 
template<size_t N, typename TypeList >
using get_t = typename get< N, TypeList >::type
 The N-th type in the provided type_list. More...
 
template<size_t N, typename TypeList >
using skip_t = typename skip< N, TypeList >::type
 Skips the first N types in the provided type_list. More...
 
template<typename T >
using as_type_list_t = typename as_type_list< T >::type
 A typedef for a type_list with template type parameters equivalent to the type parameters of the provided type. More...
 
template<typename T >
using as_tuple_t = typename as_tuple< T >::type
 A typedef for a std::tuple specialization with template type parameters equivalent to the type parameters of the provided type. More...
 
template<typename TypeList >
using first = get< 0, TypeList >
 Accesses first type in the list. More...
 
template<typename TypeList >
using first_t = typename first< TypeList >::type
 Accesses last type in the list. More...
 
template<typename TypeList >
using last = get< TypeList::size - 1, TypeList >
 Accesses last type in the list. More...
 
template<typename TypeList >
using last_t = typename last< TypeList >::type
 Accesses last type in the list. More...
 
template<typename TypeList >
using tail = skip< 1, TypeList >
 Returns all but the first element of the list. More...
 
template<typename TypeList >
using tail_t = typename tail< TypeList >::type
 Returns all but the first element of the list. More...
 
template<size_t N, typename TypeList >
using take = detail::take< type_list<>, N, TypeList >
 Returns the first N elements of the list. More...
 
template<size_t N, typename TypeList >
using take_t = typename take< N, TypeList >::type
 Returns the first N elements of the list. More...
 
template<typename TypeList >
using init = take< TypeList::size - 1, TypeList >
 Returns all but the last element of the list. More...
 
template<typename TypeList >
using init_t = typename init< TypeList >::type
 Returns all but the last element of the list. More...
 
template<typename TypeList >
using reverse_t = typename reverse< TypeList >::type
 Reverses a list of types. More...
 
template<typename... Ts>
using concat_t = typename concat< Ts... >::type
 Concatenates two lists together. More...
 
template<typename T , typename TypeList >
using append_t = typename append< T, TypeList >::type
 Appends a type to the list. More...
 
template<typename T , typename TypeList >
using prepend_t = typename prepend< T, TypeList >::type
 Prepends a type to the list. More...
 
template<template< typename > typename Predicate, typename TypeList >
using filter_t = typename filter< Predicate, TypeList >::type
 Filters a type_list according to a predicate template with a static boolean member named "value" (e.g. More...
 
template<template< typename > typename Mapper, typename... Ts>
using map_t = typename map< Mapper, Ts... >::type
 Transforms a type_list according to a predicate template with a typedef named "type" (e.g. More...
 
template<typename T >
using unique_t = typename unique< T >::type
 Creates a new list containing the repeating elements in the source list only once. More...
 

Variables

template<typename T >
constexpr bool is_type_v { is_type<T>::value }
 Detects whether the type T is a type_descriptor. More...
 

Detailed Description

Provides type-level operations for refl-cpp related use-cases.

The refl::trait namespace provides type-level operations useful for compile-time metaprogramming.

Typedef Documentation

◆ append_t

template<typename T , typename TypeList >
using refl::trait::append_t = typedef typename append<T, TypeList>::type

Appends a type to the list.

See also
prepend

◆ as_tuple_t

template<typename T >
using refl::trait::as_tuple_t = typedef typename as_tuple<T>::type

A typedef for a std::tuple specialization with template type parameters equivalent to the type parameters of the provided type.

The provided type must be a template specialization.

See also
as_tuple

◆ as_type_list_t

template<typename T >
using refl::trait::as_type_list_t = typedef typename as_type_list<T>::type

A typedef for a type_list with template type parameters equivalent to the type parameters of the provided type.

The provided type must be a template instance.

See also
as_type_list

◆ concat_t

template<typename... Ts>
using refl::trait::concat_t = typedef typename concat<Ts...>::type

Concatenates two lists together.

See also
concat

◆ filter_t

template<template< typename > typename Predicate, typename TypeList >
using refl::trait::filter_t = typedef typename filter<Predicate, TypeList>::type

Filters a type_list according to a predicate template with a static boolean member named "value" (e.g.

std::is_trivial)

See also
filter

◆ first

template<typename TypeList >
using refl::trait::first = typedef get<0, TypeList>

Accesses first type in the list.

◆ first_t

template<typename TypeList >
using refl::trait::first_t = typedef typename first<TypeList>::type

Accesses last type in the list.

See also
last

◆ get_t

template<size_t N, typename TypeList >
using refl::trait::get_t = typedef typename get<N, TypeList>::type

The N-th type in the provided type_list.

See also
get

◆ init

template<typename TypeList >
using refl::trait::init = typedef take<TypeList::size - 1, TypeList>

Returns all but the last element of the list.

◆ init_t

template<typename TypeList >
using refl::trait::init_t = typedef typename init<TypeList>::type

Returns all but the last element of the list.

See also
tail

◆ last

template<typename TypeList >
using refl::trait::last = typedef get<TypeList::size - 1, TypeList>

Accesses last type in the list.

◆ last_t

template<typename TypeList >
using refl::trait::last_t = typedef typename last<TypeList>::type

Accesses last type in the list.

See also
last

◆ map_t

template<template< typename > typename Mapper, typename... Ts>
using refl::trait::map_t = typedef typename map<Mapper, Ts...>::type

Transforms a type_list according to a predicate template with a typedef named "type" (e.g.

std::remove_reference)

See also
map

◆ prepend_t

template<typename T , typename TypeList >
using refl::trait::prepend_t = typedef typename prepend<T, TypeList>::type

Prepends a type to the list.

See also
prepend

◆ remove_qualifiers_t

template<typename T >
using refl::trait::remove_qualifiers_t = typedef typename remove_qualifiers<T>::type

Removes all reference and cv-qualifiers from T.

Equivalent to std::remove_cvref_t which is not currently available on all C++17 compilers.

◆ reverse_t

template<typename TypeList >
using refl::trait::reverse_t = typedef typename reverse<TypeList>::type

Reverses a list of types.

See also
reverse

◆ skip_t

template<size_t N, typename TypeList >
using refl::trait::skip_t = typedef typename skip<N, TypeList>::type

Skips the first N types in the provided type_list.

See also
skip

◆ tail

template<typename TypeList >
using refl::trait::tail = typedef skip<1, TypeList>

Returns all but the first element of the list.

◆ tail_t

template<typename TypeList >
using refl::trait::tail_t = typedef typename tail<TypeList>::type

Returns all but the first element of the list.

See also
tail

◆ take

template<size_t N, typename TypeList >
using refl::trait::take = typedef detail::take<type_list<>, N, TypeList>

Returns the first N elements of the list.

◆ take_t

template<size_t N, typename TypeList >
using refl::trait::take_t = typedef typename take<N, TypeList>::type

Returns the first N elements of the list.

◆ unique_t

template<typename T >
using refl::trait::unique_t = typedef typename unique<T>::type

Creates a new list containing the repeating elements in the source list only once.

Variable Documentation

◆ is_type_v

template<typename T >
constexpr bool refl::trait::is_type_v { is_type<T>::value }
constexpr

Detects whether the type T is a type_descriptor.

See also
is_type