GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
metaprogramming.hpp File Reference

Go to the source code of this file.

Classes

struct  grem::meta::Constant< X >
 Wrapper type for a compile-time constant value. More...
struct  grem::meta::Type< T >
 Type identity wrapper. More...
struct  grem::meta::TypeList< Ts >
 Compile-time list of types. More...

Namespaces

namespace  grem
namespace  grem::meta

Concepts

concept  grem::meta::type_list
 Concept that checks if a given type is a specialization of meta::TypeList.

Typedefs

template<typename List, std::size_t Index>
using grem::meta::type_list_type_t = typename type_list_type<List, Index>::type
 Type at a specific index of a specialization of meta::TypeList.
template<typename... Lists>
using grem::meta::type_list_concat_t = typename type_list_concat<Lists...>::type
 Concatenation of a sequence of specializations of meta::TypeList into a single meta::TypeList.
template<typename Aggregate>
using grem::meta::aggregate_field_types_t = typename aggregate_field_types<Aggregate>::type
 Type list containing the types of the fields of a given aggregate type.
template<std::size_t Index, typename Aggregate>
using grem::meta::aggregate_field_type_t = typename aggregate_field_type<Index, Aggregate>::type
 Type of a given field of an aggregate type.
template<auto Member>
using grem::meta::member_pointer_target_type_t = typename member_pointer_target_type<Member>::type
 Target member type of a given pointer-to-member.
template<auto Member>
using grem::meta::member_pointer_object_type_t = typename member_pointer_object_type<Member>::type
 Object type of a given pointer-to-member.
template<typename Function>
using grem::meta::function_parameter_types_t = typename function_parameter_types<Function>::type
 List of parameter types of a given function.
template<typename Function>
using grem::meta::function_return_type_t = typename function_return_type<Function>::type
 Return type of a given function.
template<typename V>
using grem::meta::variant_alternative_types_t = typename variant_alternative_types<V>::type
 List of all alternative types of a given variant.
template<typename T>
using grem::meta::tuple_element_types_t = typename tuple_element_types<T>::type
 List of all element types of a given tuple.
template<typename V>
using grem::meta::tuple_of_variant_alternatives_t = typename tuple_of_variant_alternatives<V>::type
 Tuple of all alternative types of a given variant.

Functions

template<size_t N, typename T, typename... Args>
constexpr auto grem::meta::createN (Args &&... args)
 Construct a fixed-size array of N elements of type T, where each element is constructed from the same arguments.
template<typename T, size_t N>
constexpr auto grem::meta::transform (Array< T, N > &array, auto fn)
 Execute a function for each element in a given array and return an array containing the results.
template<typename T, size_t N>
constexpr auto grem::meta::transform (const Array< T, N > &array, auto fn)
 Execute a function for each element in a given array and return an array containing the results.
template<typename T, size_t N>
constexpr auto grem::meta::transform (Array< T, N > &&array, auto fn)
 Execute a function for each element in a given array and return an array containing the results.
template<typename T, size_t N>
constexpr auto grem::meta::transform (const Array< T, N > &&array, auto fn)
 Execute a function for each element in a given array and return an array containing the results.
constexpr auto grem::meta::transform (auto &&tuple, auto fn)
 Execute a function for each element in a given tuple and return a tuple containing the results.
constexpr void grem::meta::forEach (auto &&tuple, auto fn)
 Execute a function for each element in a given tuple, sequentially.
template<std::size_t N>
constexpr void grem::meta::forEachIndex (auto fn)
 Execute a function for each index in the sequence from 0 up to, but not including, a given count N.
template<size_t N, typename T>
constexpr auto grem::meta::generateN (auto fn)
 Construct a fixed-size array, using a function to create each of its elements, optionally based on the element index.
template<std::size_t N>
constexpr decltype(auto) grem::meta::visitIndex (std::size_t index, auto fn)
 Execute a function associated with one specific index in the sequence from 0 up to, but not including, a given count N.
template<typename List>
constexpr void grem::meta::forEachType (auto fn)
 Execute a function for each type in a type list.
template<typename Aggregate>
constexpr void grem::meta::forEachFieldIndex (auto fn)
 Execute a function for each field index of an aggregate.
template<typename Aggregate>
constexpr void grem::meta::forEachFieldType (auto fn)
 Execute a function for each field type of an aggregate.
template<typename Aggregate>
constexpr void grem::meta::forEachIndexedFieldType (auto fn)
 Execute a function for each field type of an aggregate, also including the field index.
constexpr auto grem::meta::getFields (auto &&value) noexcept
 Get a tuple of references to each of the fields of an aggregate.
template<typename Aggregate>
constexpr void grem::meta::forEachField (Aggregate &&value, auto fn)
 Execute a function for each field of an aggregate.
template<typename Aggregate>
constexpr void grem::meta::forEachIndexedField (Aggregate &&value, auto fn)
 Execute a function for each field of an aggregate, also including the field index.
template<typename Aggregate>
constexpr void grem::meta::forEachNamedFieldIndex (auto fn)
 Execute a function for each field index of an aggregate, also including the field name.
template<typename Aggregate>
constexpr void grem::meta::forEachNamedFieldType (auto fn)
 Execute a function for each field type of an aggregate, also including the field name.
template<typename Aggregate>
constexpr void grem::meta::forEachIndexedNamedFieldType (auto fn)
 Execute a function for each field type of an aggregate, also including the field name and index.
template<typename Aggregate>
constexpr void grem::meta::forEachNamedField (Aggregate &&value, auto fn)
 Execute a function for each field of an aggregate, also including the field name.
template<typename Aggregate>
constexpr void grem::meta::forEachIndexedNamedField (Aggregate &&value, auto fn)
 Execute a function for each field of an aggregate, also including the field index and name.
template<enumeration Enum>
constexpr decltype(auto) grem::meta::visitEnumerand (Enum value, auto fn)
 Execute a function associated with one specific enumerand in the sequence of valid enumerands starting at value 0 in a given enum type.
template<enumeration Enum>
constexpr void grem::meta::forEachEnumerand (auto fn)
 Execute a function for each consecutive valid enumerand starting at value 0 in a given enum type.
template<enumeration Enum>
constexpr void grem::meta::forEachIndexedEnumerand (auto fn)
 Execute a function for each consecutive valid enumerand starting at value 0 in a given enum type, also including the enumerand index.
template<enumeration Enum>
constexpr void grem::meta::forEachNamedEnumerand (auto fn)
 Execute a function for each consecutive valid enumerand starting at value 0 in a given enum type, also including the enumerand name.
template<enumeration Enum>
constexpr void grem::meta::forEachIndexedNamedEnumerand (auto fn)
 Execute a function for each consecutive valid enumerand starting at value 0 in a given enum type, also including the enumerand index and name.
template<enumeration Enum>
constexpr CStringView grem::meta::getEnumerandName (Enum value)
 Get the name of a specific enumerand in a given enum type.

Variables

template<typename... Ts>
constexpr bool grem::meta::always_false_v = false
 Type-dependent boolean that always evaluates to false.
template<auto X>
constexpr Constant< X > grem::meta::CONSTANT {}
 Wrapper value for a compile-time constant value.
template<typename T>
constexpr Type< T > grem::meta::TYPE {}
 Wrapper value for a type identity wrapper.
template<typename... Ts>
constexpr TypeList< Ts... > grem::meta::TYPE_LIST {}
 Wrapper value for a compile-time list of types.
template<typename T>
constexpr bool grem::meta::is_type_list_v = is_type_list<T>::value
 Boolean that evaluates to true if the given type is a specialization of meta::TypeList.
template<typename List>
constexpr std::size_t grem::meta::type_list_size_v = type_list_size<List>::value
 Number of types in a specialization of meta::TypeList.
template<typename List>
constexpr bool grem::meta::type_list_empty_v = type_list_empty<List>::value
 Whether a specialization of meta::TypeList is empty or not.
template<typename List, typename T>
constexpr bool grem::meta::type_list_contains_v = type_list_contains<List, T>::value
 Whether a specialization of meta::TypeList contains a specific type.
template<typename List, typename T>
constexpr std::size_t grem::meta::type_list_index_v = type_list_index<List, T>::value
 Index of the first occurence of a specific type in a specialization of meta::TypeList.
template<typename List, typename T>
constexpr std::size_t grem::meta::type_list_rindex_v = type_list_rindex<List, T>::value
 Index of the last occurence of a specific type in a specialization of meta::TypeList.
template<typename List, typename T>
constexpr std::size_t grem::meta::type_list_count_v = type_list_count<List, T>::value
 Number of occurences of a sepcific type in a specialization of meta::TypeList.
template<typename List, typename PrefixList>
constexpr bool grem::meta::type_list_starts_with_v = type_list_starts_with<List, PrefixList>::value
 Whether a specialization of meta::TypeList starts with the types in another type list.
template<typename List, typename T>
constexpr bool grem::meta::type_list_starts_with_type_v = type_list_starts_with_type<List, T>::value
 Whether a specialization of meta::TypeList starts with a specific type.
template<typename Aggregate>
constexpr std::size_t grem::meta::aggregate_size_v = aggregate_size<Aggregate>::value
 The number of fields in a given aggregate type.
template<typename T>
constexpr auto grem::meta::unqualified_type_name_v = ConstantString<char, unqualified_type_name<T>::value.size()>{unqualified_type_name<T>::value}
 Unqualified name of a type.
template<std::size_t Index, typename Aggregate>
constexpr auto grem::meta::aggregate_field_name_v = ConstantString<char, aggregate_field_name<Index, Aggregate>::value.size()>{aggregate_field_name<Index, Aggregate>::value}
 Name of the field at a given index of an aggregate type.
template<std::size_t Index, typename Enum>
constexpr auto grem::meta::enumerand_name_at_v = ConstantString<char, enumerand_name_at<Index, Enum>::value.size()>{enumerand_name_at<Index, Enum>::value}
 Name of the enumerand at a given index of an enum type.
template<auto Enumerand>
constexpr auto grem::meta::enumerand_name_v = ConstantString<char, enumerand_name<Enumerand>::value.size()>{enumerand_name<Enumerand>::value}
 Name of a given enumerand of an enum type.
template<typename Enum>
constexpr std::size_t grem::meta::enum_size_v = enum_size<Enum>::value
 The number of consecutive valid enumerands starting at value 0 in a given enum type.
template<auto Member>
constexpr size_t grem::meta::member_pointer_index_v = member_pointer_index<Member>::value
 Index of the field referenced by a given pointer-to-member in its outer struct.