GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::meta Namespace Reference

Classes

struct  Constant
 Wrapper type for a compile-time constant value. More...
struct  Type
 Type identity wrapper. More...
struct  TypeList
 Compile-time list of types. More...

Concepts

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

Typedefs

template<typename List, std::size_t Index>
using 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 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 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 aggregate_field_type_t = typename aggregate_field_type<Index, Aggregate>::type
 Type of a given field of an aggregate type.
template<auto Member>
using 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 member_pointer_object_type_t = typename member_pointer_object_type<Member>::type
 Object type of a given pointer-to-member.
template<typename Function>
using function_parameter_types_t = typename function_parameter_types<Function>::type
 List of parameter types of a given function.
template<typename Function>
using function_return_type_t = typename function_return_type<Function>::type
 Return type of a given function.
template<typename V>
using variant_alternative_types_t = typename variant_alternative_types<V>::type
 List of all alternative types of a given variant.
template<typename T>
using tuple_element_types_t = typename tuple_element_types<T>::type
 List of all element types of a given tuple.
template<typename V>
using 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 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 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 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 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 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 transform (auto &&tuple, auto fn)
 Execute a function for each element in a given tuple and return a tuple containing the results.
constexpr void forEach (auto &&tuple, auto fn)
 Execute a function for each element in a given tuple, sequentially.
template<std::size_t N>
constexpr void 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 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) 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 forEachType (auto fn)
 Execute a function for each type in a type list.
template<typename Aggregate>
constexpr void forEachFieldIndex (auto fn)
 Execute a function for each field index of an aggregate.
template<typename Aggregate>
constexpr void forEachFieldType (auto fn)
 Execute a function for each field type of an aggregate.
template<typename Aggregate>
constexpr void forEachIndexedFieldType (auto fn)
 Execute a function for each field type of an aggregate, also including the field index.
constexpr auto getFields (auto &&value) noexcept
 Get a tuple of references to each of the fields of an aggregate.
template<typename Aggregate>
constexpr void forEachField (Aggregate &&value, auto fn)
 Execute a function for each field of an aggregate.
template<typename Aggregate>
constexpr void forEachIndexedField (Aggregate &&value, auto fn)
 Execute a function for each field of an aggregate, also including the field index.
template<typename Aggregate>
constexpr void forEachNamedFieldIndex (auto fn)
 Execute a function for each field index of an aggregate, also including the field name.
template<typename Aggregate>
constexpr void forEachNamedFieldType (auto fn)
 Execute a function for each field type of an aggregate, also including the field name.
template<typename Aggregate>
constexpr void 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 forEachNamedField (Aggregate &&value, auto fn)
 Execute a function for each field of an aggregate, also including the field name.
template<typename Aggregate>
constexpr void 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) 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 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 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 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 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 getEnumerandName (Enum value)
 Get the name of a specific enumerand in a given enum type.

Variables

template<typename... Ts>
constexpr bool always_false_v = false
 Type-dependent boolean that always evaluates to false.
template<auto X>
constexpr Constant< X > CONSTANT {}
 Wrapper value for a compile-time constant value.
template<typename T>
constexpr Type< T > TYPE {}
 Wrapper value for a type identity wrapper.
template<typename... Ts>
constexpr TypeList< Ts... > TYPE_LIST {}
 Wrapper value for a compile-time list of types.
template<typename T>
constexpr bool 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 type_list_size_v = type_list_size<List>::value
 Number of types in a specialization of meta::TypeList.
template<typename List>
constexpr bool 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 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 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 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 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 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 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 aggregate_size_v = aggregate_size<Aggregate>::value
 The number of fields in a given aggregate type.
template<typename T>
constexpr auto 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 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 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 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 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 member_pointer_index_v = member_pointer_index<Member>::value
 Index of the field referenced by a given pointer-to-member in its outer struct.

Typedef Documentation

◆ type_list_type_t

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 Parameters
Listtype list to get the type from. Must be a specialization of meta::TypeList.
Indexindex of the type to get. Must be less than the type list size.

◆ type_list_concat_t

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 Parameters
Liststype lists to concatenate. Must all be specializations of meta::TypeList.

◆ aggregate_field_types_t

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 Parameters
Aggregateaggregate type to get the field types of.
Warning
Only sizes up to 32 are supported. If the template is instantiated with an aggregate type containing more than 32 fields, the program is ill-formed.

◆ aggregate_field_type_t

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 Parameters
Indexindex of the field to get the type of.
Aggregateaggregate type to get the field type of.
Warning
Only sizes up to 32 are supported. If the template is instantiated with an aggregate type containing more than 32 fields, the program is ill-formed.

◆ member_pointer_target_type_t

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 Parameters
Pointerto member to get the target type of.

◆ member_pointer_object_type_t

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 Parameters
Pointerto member to get the object type of.

◆ function_parameter_types_t

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 Parameters
Functionfunction type to get the parameter types of.

◆ function_return_type_t

template<typename Function>
using grem::meta::function_return_type_t = typename function_return_type<Function>::type

Return type of a given function.

Template Parameters
Functionfunction type to get the return type of.

◆ variant_alternative_types_t

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 Parameters
Vvariant type to get the alternative types of.

◆ tuple_element_types_t

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 Parameters
Ttuple type to get the element types of.

◆ tuple_of_variant_alternatives_t

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.

Template Parameters
Vvariant type to get the alternative types tuple of.

Function Documentation

◆ createN()

template<size_t N, typename T, typename... Args>
auto grem::meta::createN ( Args &&... args)
nodiscardconstexpr

Construct a fixed-size array of N elements of type T, where each element is constructed from the same arguments.

Template Parameters
Nsize of the array to construct.
Telement type of the array to construct.
Parameters
argsarguments to pass to each element's constructor.
Exceptions
anyexception thrown by the element constructors or by making an array from the results.

◆ transform() [1/5]

template<typename T, size_t N>
auto grem::meta::transform ( Array< T, N > & array,
auto fn )
nodiscardconstexpr

Execute a function for each element in a given array and return an array containing the results.

Parameters
arrayarray to transform.
fnfunction to execute. Must accept a reference to the array's element type as a parameter and return a non-void value.
Exceptions
anyexception thrown by fn or by making an array from the results.

◆ transform() [2/5]

template<typename T, size_t N>
auto grem::meta::transform ( const Array< T, N > & array,
auto fn )
nodiscardconstexpr

Execute a function for each element in a given array and return an array containing the results.

Parameters
arrayarray to transform.
fnfunction to execute. Must accept a reference to the array's element type as a parameter and return a non-void value.
Exceptions
anyexception thrown by fn or by making an array from the results.

◆ transform() [3/5]

template<typename T, size_t N>
auto grem::meta::transform ( Array< T, N > && array,
auto fn )
nodiscardconstexpr

Execute a function for each element in a given array and return an array containing the results.

Parameters
arrayarray to transform.
fnfunction to execute. Must accept a reference to the array's element type as a parameter and return a non-void value.
Exceptions
anyexception thrown by fn or by making an array from the results.

◆ transform() [4/5]

template<typename T, size_t N>
auto grem::meta::transform ( const Array< T, N > && array,
auto fn )
nodiscardconstexpr

Execute a function for each element in a given array and return an array containing the results.

Parameters
arrayarray to transform.
fnfunction to execute. Must accept a reference to the array's element type as a parameter and return a non-void value.
Exceptions
anyexception thrown by fn or by making an array from the results.

◆ transform() [5/5]

auto grem::meta::transform ( auto && tuple,
auto fn )
nodiscardconstexpr

Execute a function for each element in a given tuple and return a tuple containing the results.

Parameters
tupletuple to transform.
fnfunction to execute. Must accept a reference to each of the types in the tuple as a parameter and return a non-void value.
Exceptions
anyexception thrown by fn or by making a tuple from the results.

◆ forEach()

void grem::meta::forEach ( auto && tuple,
auto fn )
constexpr

Execute a function for each element in a given tuple, sequentially.

Parameters
tupletuple to iterate.
fnfunction to execute. Must accept a reference to each of the types in the tuple as a parameter.
Exceptions
anyexception thrown by fn.

◆ forEachIndex()

template<std::size_t N>
void grem::meta::forEachIndex ( auto fn)
constexpr

Execute a function for each index in the sequence from 0 up to, but not including, a given count N.

Template Parameters
Nthe number of indices in the sequence.
Parameters
fnfunction to execute. Must accept an object of type meta::Constant<I> as a parameter, where I is any integer from 0 up to, but not including, N.
Exceptions
anyexception thrown by fn.

◆ generateN()

template<size_t N, typename T>
auto grem::meta::generateN ( auto fn)
nodiscardconstexpr

Construct a fixed-size array, using a function to create each of its elements, optionally based on the element index.

Template Parameters
Nsize of the array to generate.
Telement type of the array to generate.
Parameters
fnfunction that generates each element. May optionally accept the index of the array as either a size_t parameter or meta::Constant parameter with a non-type template parameter of type size_t as its template argument.
Exceptions
anyexception thrown by fn or by making an array from the results.

◆ visitIndex()

template<std::size_t N>
decltype(auto) grem::meta::visitIndex ( std::size_t index,
auto fn )
constexpr

Execute a function associated with one specific index in the sequence from 0 up to, but not including, a given count N.

Template Parameters
Nthe number of indices in the sequence.
Parameters
indexthe index to execute the corresponding function overload of.
fnfunction to execute. Must accept an object of type meta::Constant<I> as a parameter, where I is any integer from 0 up to, but not including, N.
Returns
the result of fn.
Exceptions
std::out_of_rangeif index >= N.
anyexception thrown by fn.

◆ forEachType()

template<typename List>
void grem::meta::forEachType ( auto fn)
constexpr

Execute a function for each type in a type list.

Template Parameters
ListTypeList type.
Parameters
fnfunction to execute. Must accept an object of type meta::Type<T> as a parameter, where T is any type in the given type list.
Exceptions
anyexception thrown by fn.

◆ forEachFieldIndex()

template<typename Aggregate>
void grem::meta::forEachFieldIndex ( auto fn)
constexpr

Execute a function for each field index of an aggregate.

Template Parameters
Aggregatetype to iterate the field indices of.
Parameters
fnfunction to execute. Must accept an object of type meta::Constant<I> as a parameter, where I is any integer from 0 up to, but not including, the number of fields in the aggregate.
Warning
Only aggregate sizes up to 32 are supported. If the function is instantiated with an aggregate type containing more than 32 fields, the program is ill-formed.
Exceptions
anyexception thrown by fn.

◆ forEachFieldType()

template<typename Aggregate>
void grem::meta::forEachFieldType ( auto fn)
constexpr

Execute a function for each field type of an aggregate.

Template Parameters
Aggregatetype to iterate the field types of.
Parameters
fnfunction to execute. Must accept an object of type meta::Type<T> as a parameter, where T is any field type of the aggregate.
Warning
Only aggregate sizes up to 32 are supported. If the function is instantiated with an aggregate type containing more than 32 fields, the program is ill-formed.
Exceptions
anyexception thrown by fn.

◆ forEachIndexedFieldType()

template<typename Aggregate>
void grem::meta::forEachIndexedFieldType ( auto fn)
constexpr

Execute a function for each field type of an aggregate, also including the field index.

Template Parameters
Aggregatetype to iterate the indexed field types of.
Parameters
fnfunction to execute. Must accept the two following parameters:
  • an object of type meta::Constant<I>, where I is any integer from 0 up to, but not including, the number of fields in the aggregate.
  • an object of type meta::Type<T>, where T is any field type of the aggregate.
Warning
Only aggregate sizes up to 32 are supported. If the function is instantiated with an aggregate type containing more than 32 fields, the program is ill-formed.
Exceptions
anyexception thrown by fn.

◆ getFields()

auto grem::meta::getFields ( auto && value)
nodiscardconstexprnoexcept

Get a tuple of references to each of the fields of an aggregate.

Parameters
valueforwarding reference to an object of an aggregate type.
Returns
a tuple where each element is an lvalue reference to the respective field of the aggregate, based on the declaration order of the fields.
Warning
Only aggregate sizes up to 32 are supported. If the function is instantiated with an aggregate type containing more than 32 fields, the program is ill-formed.

◆ forEachField()

template<typename Aggregate>
void grem::meta::forEachField ( Aggregate && value,
auto fn )
constexpr

Execute a function for each field of an aggregate.

Parameters
valueforwarding reference to an object of an aggregate type.
fnfunction to execute. Must accept a reference to each field type of the aggregate.
Warning
Only aggregate sizes up to 32 are supported. If the function is instantiated with an aggregate type containing more than 32 fields, the program is ill-formed.
Exceptions
anyexception thrown by fn.

◆ forEachIndexedField()

template<typename Aggregate>
void grem::meta::forEachIndexedField ( Aggregate && value,
auto fn )
constexpr

Execute a function for each field of an aggregate, also including the field index.

Parameters
valueforwarding reference to an object of an aggregate type.
fnfunction to execute. Must accept the two following parameters:
  • an object of type meta::Constant<I>, where I is any integer from 0 up to, but not including, the number of fields in the aggregate.
  • a reference to each field type of the aggregate.
Warning
Only aggregate sizes up to 32 are supported. If the function is instantiated with an aggregate type containing more than 32 fields, the program is ill-formed.
Exceptions
anyexception thrown by fn.

◆ forEachNamedFieldIndex()

template<typename Aggregate>
void grem::meta::forEachNamedFieldIndex ( auto fn)
constexpr

Execute a function for each field index of an aggregate, also including the field name.

Template Parameters
Aggregatetype to iterate the named field indices of.
Parameters
fnfunction to execute. Must accept the two following parameters:
  • a StringView of each field name.
  • an object of type meta::Constant<I>, where I is any integer from 0 up to, but not including, the number of fields in the aggregate.
Warning
Only aggregate sizes up to 32 are supported. If the function is instantiated with an aggregate type containing more than 32 fields, the program is ill-formed.
Exceptions
anyexception thrown by fn.

◆ forEachNamedFieldType()

template<typename Aggregate>
void grem::meta::forEachNamedFieldType ( auto fn)
constexpr

Execute a function for each field type of an aggregate, also including the field name.

Template Parameters
Aggregatetype to iterate the named field types of.
Parameters
fnfunction to execute. Must accept the two following parameters:
  • a StringView of each field name.
  • an object of type meta::Type<T>, where T is any field type of the aggregate.
Warning
Only aggregate sizes up to 32 are supported. If the function is instantiated with an aggregate type containing more than 32 fields, the program is ill-formed.
Exceptions
anyexception thrown by fn.

◆ forEachIndexedNamedFieldType()

template<typename Aggregate>
void grem::meta::forEachIndexedNamedFieldType ( auto fn)
constexpr

Execute a function for each field type of an aggregate, also including the field name and index.

Template Parameters
Aggregatetype to iterate the indexed named field types of.
Parameters
fnfunction to execute. Must accept the two following parameters:
  • an object of type meta::Constant<I>, where I is any integer from 0 up to, but not including, the number of fields in the aggregate.
  • a StringView of each field name.
  • an object of type meta::Type<T>, where T is any field type of the aggregate.
Warning
Only aggregate sizes up to 32 are supported. If the function is instantiated with an aggregate type containing more than 32 fields, the program is ill-formed.
Exceptions
anyexception thrown by fn.

◆ forEachNamedField()

template<typename Aggregate>
void grem::meta::forEachNamedField ( Aggregate && value,
auto fn )
constexpr

Execute a function for each field of an aggregate, also including the field name.

Parameters
valueforwarding reference to an object of an aggregate type.
fnfunction to execute. Must accept the two following parameters:
  • a StringView of each field name.
  • a reference to each field type of the aggregate.
Warning
Only aggregate sizes up to 32 are supported. If the function is instantiated with an aggregate type containing more than 32 fields, the program is ill-formed.
Exceptions
anyexception thrown by fn.

◆ forEachIndexedNamedField()

template<typename Aggregate>
void grem::meta::forEachIndexedNamedField ( Aggregate && value,
auto fn )
constexpr

Execute a function for each field of an aggregate, also including the field index and name.

Parameters
valueforwarding reference to an object of an aggregate type.
fnfunction to execute. Must accept the three following parameters:
  • an object of type meta::Constant<I>, where I is any integer from 0 up to, but not including, the number of fields in the aggregate.
  • a StringView of each field name.
  • a reference to each field type of the aggregate.
Warning
Only aggregate sizes up to 32 are supported. If the function is instantiated with an aggregate type containing more than 32 fields, the program is ill-formed.
Exceptions
anyexception thrown by fn.

◆ visitEnumerand()

template<enumeration Enum>
decltype(auto) grem::meta::visitEnumerand ( Enum value,
auto fn )
constexpr

Execute a function associated with one specific enumerand in the sequence of valid enumerands starting at value 0 in a given enum type.

Template Parameters
Enumenum type. Must have a fixed underlying type.
Parameters
valuethe enumerand to execute the corresponding function overload of.
fnfunction to execute. Must accept an object of type meta::Constant<Enumerand> as a parameter, where Enumerand is any enumeration value from 0 up to, but not including, meta::enum_size_v<Enum>.
Returns
the result of fn.
Exceptions
std::out_of_rangeif static_cast<std::size_t>(value) >= meta::enum_size_v<Enum>.
anyexception thrown by fn.

◆ forEachEnumerand()

template<enumeration Enum>
void grem::meta::forEachEnumerand ( auto fn)
constexpr

Execute a function for each consecutive valid enumerand starting at value 0 in a given enum type.

Template Parameters
Enumenum type. Must have a fixed underlying type.
Parameters
fnfunction to execute. Must accept an object of type meta::Constant<Enumerand> as a parameter, where Enumerand is any enumeration value from 0 up to, but not including, meta::enum_size_v<Enum>.
Exceptions
anyexception thrown by fn.

◆ forEachIndexedEnumerand()

template<enumeration Enum>
void grem::meta::forEachIndexedEnumerand ( auto fn)
constexpr

Execute a function for each consecutive valid enumerand starting at value 0 in a given enum type, also including the enumerand index.

Template Parameters
Enumenum type. Must have a fixed underlying type.
Parameters
fnfunction to execute. Must accept the two following parameters:
Exceptions
anyexception thrown by fn.

◆ forEachNamedEnumerand()

template<enumeration Enum>
void grem::meta::forEachNamedEnumerand ( auto fn)
constexpr

Execute a function for each consecutive valid enumerand starting at value 0 in a given enum type, also including the enumerand name.

Template Parameters
Enumenum type. Must have a fixed underlying type.
Parameters
fnfunction to execute. Must accept the two following parameters:
Exceptions
anyexception thrown by fn.

◆ forEachIndexedNamedEnumerand()

template<enumeration Enum>
void grem::meta::forEachIndexedNamedEnumerand ( auto fn)
constexpr

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 Parameters
Enumenum type. Must have a fixed underlying type.
Parameters
fnfunction to execute. Must accept the three following parameters:
Exceptions
anyexception thrown by fn.

◆ getEnumerandName()

template<enumeration Enum>
CStringView grem::meta::getEnumerandName ( Enum value)
nodiscardconstexpr

Get the name of a specific enumerand in a given enum type.

Template Parameters
Enumenum type. Must have a fixed underlying type.
Parameters
valuethe enumerand to get the name of.
Returns
the unqualified name of the given enumerand, with static storage duration.
Exceptions
std::out_of_rangeif static_cast<std::size_t>(value) >= meta::enum_size_v<Enum>.

Variable Documentation

◆ always_false_v

template<typename... Ts>
bool grem::meta::always_false_v = false
inlineconstexpr

Type-dependent boolean that always evaluates to false.

Template Parameters
Tstype(s) that the value conceptually "depends" on.
Warning
Must not be specialized.
Remarks
This is mainly intended for use with static_assert() in templates, for example to raise a compile-time error in the last else of an if constexpr chain as follows: static_assert(meta::always_false_v<T>, "Bad type.");. Note that a simple static_assert(false, "Bad type"); doesn't work since the expression doesn't depend on any template arguments, and the compiler can therefore infer that it fails unequivocally for all possible instantiations of the template. Making the expression depend on a template argument circumvents this, since the compiler then has to assume that there could be some specialization of always_false_v for some unknown future type that makes it evaluate to true (although we never actually define such a specialization, except for detail::UnusedType).

◆ CONSTANT

template<auto X>
Constant<X> grem::meta::CONSTANT {}
constexpr

Wrapper value for a compile-time constant value.

Template Parameters
Xconstant value to wrap.

◆ TYPE

template<typename T>
Type<T> grem::meta::TYPE {}
constexpr

Wrapper value for a type identity wrapper.

Template Parameters
Ttype to wrap.

◆ TYPE_LIST

template<typename... Ts>
TypeList<Ts...> grem::meta::TYPE_LIST {}
constexpr

Wrapper value for a compile-time list of types.

Template Parameters
Tspack of types to wrap.

◆ is_type_list_v

template<typename T>
bool grem::meta::is_type_list_v = is_type_list<T>::value
inlineconstexpr

Boolean that evaluates to true if the given type is a specialization of meta::TypeList.

Template Parameters
Ttype to check.

◆ type_list_size_v

template<typename List>
std::size_t grem::meta::type_list_size_v = type_list_size<List>::value
inlineconstexpr

Number of types in a specialization of meta::TypeList.

Template Parameters
Listtype list to get the size of. Must be a specialization of meta::TypeList.

◆ type_list_empty_v

template<typename List>
bool grem::meta::type_list_empty_v = type_list_empty<List>::value
inlineconstexpr

Whether a specialization of meta::TypeList is empty or not.

Template Parameters
Listtype list to check.

◆ type_list_contains_v

template<typename List, typename T>
bool grem::meta::type_list_contains_v = type_list_contains<List, T>::value
inlineconstexpr

Whether a specialization of meta::TypeList contains a specific type.

Template Parameters
Listtype list to check. Must be a specialization of meta::TypeList.
Ttype to check for.

◆ type_list_index_v

template<typename List, typename T>
std::size_t grem::meta::type_list_index_v = type_list_index<List, T>::value
inlineconstexpr

Index of the first occurence of a specific type in a specialization of meta::TypeList.

Template Parameters
Listtype list to get the index from. Must be a specialization of meta::TypeList.
Ttype to get the index of. Must be a type that the type list contains.

◆ type_list_rindex_v

template<typename List, typename T>
std::size_t grem::meta::type_list_rindex_v = type_list_rindex<List, T>::value
inlineconstexpr

Index of the last occurence of a specific type in a specialization of meta::TypeList.

Template Parameters
Listtype list to get the index from. Must be a specialization of meta::TypeList.
Ttype to get the index of. Must be a type that the type list contains.

◆ type_list_count_v

template<typename List, typename T>
std::size_t grem::meta::type_list_count_v = type_list_count<List, T>::value
inlineconstexpr

Number of occurences of a sepcific type in a specialization of meta::TypeList.

Template Parameters
Listtype list. Must be a specialization of meta::TypeList.
Ttype to count the number of occurences of.

◆ type_list_starts_with_v

template<typename List, typename PrefixList>
bool grem::meta::type_list_starts_with_v = type_list_starts_with<List, PrefixList>::value
inlineconstexpr

Whether a specialization of meta::TypeList starts with the types in another type list.

Template Parameters
Listtype list to check. Must be a specialization of meta::TypeList.
PrefixListlist of prefix types to check for. Must be a specialization of meta::TypeList.

◆ type_list_starts_with_type_v

template<typename List, typename T>
bool grem::meta::type_list_starts_with_type_v = type_list_starts_with_type<List, T>::value
inlineconstexpr

Whether a specialization of meta::TypeList starts with a specific type.

Template Parameters
Listtype list to check. Must be a specialization of meta::TypeList.
Tfirst type to check for.

◆ aggregate_size_v

template<typename Aggregate>
std::size_t grem::meta::aggregate_size_v = aggregate_size<Aggregate>::value
inlineconstexpr

The number of fields in a given aggregate type.

Template Parameters
Taggregate type to get the number of fields in.
Warning
Only sizes up to 32 are supported. If the template is instantiated with an aggregate type containing more than 32 fields, the program is ill-formed.

◆ unqualified_type_name_v

template<typename T>
auto grem::meta::unqualified_type_name_v = ConstantString<char, unqualified_type_name<T>::value.size()>{unqualified_type_name<T>::value}
inlineconstexpr

Unqualified name of a type.

Template Parameters
Ttype to get the name of.
Note
The returned type name will not contain template arguments, namespace specifiers, cv-qualifiers, reference qualifiers, pointer qualifiers or array extents.

◆ aggregate_field_name_v

template<std::size_t Index, typename Aggregate>
auto grem::meta::aggregate_field_name_v = ConstantString<char, aggregate_field_name<Index, Aggregate>::value.size()>{aggregate_field_name<Index, Aggregate>::value}
inlineconstexpr

Name of the field at a given index of an aggregate type.

Template Parameters
Indexindex of the field to get the name of.
Aggregatedefault-constructible aggregate type containing the field to get the name of.
Warning
Only sizes up to 32 are supported. If the template is instantiated with an aggregate type containing more than 32 fields, the program is ill-formed.

◆ enumerand_name_at_v

template<std::size_t Index, typename Enum>
auto grem::meta::enumerand_name_at_v = ConstantString<char, enumerand_name_at<Index, Enum>::value.size()>{enumerand_name_at<Index, Enum>::value}
inlineconstexpr

Name of the enumerand at a given index of an enum type.

Template Parameters
Indexindex of the enumerand to get the name of. Must be a valid index for the given enum type.
Enumenum type containing the enumerand to get the name of. Must have a fixed underlying type.

◆ enumerand_name_v

template<auto Enumerand>
auto grem::meta::enumerand_name_v = ConstantString<char, enumerand_name<Enumerand>::value.size()>{enumerand_name<Enumerand>::value}
inlineconstexpr

Name of a given enumerand of an enum type.

Template Parameters
Enumerandvalue of the enumerand to get the name of.

◆ enum_size_v

template<typename Enum>
std::size_t grem::meta::enum_size_v = enum_size<Enum>::value
inlineconstexpr

The number of consecutive valid enumerands starting at value 0 in a given enum type.

Template Parameters
Tenum type to get the number of enumerands in.

◆ member_pointer_index_v

template<auto Member>
size_t grem::meta::member_pointer_index_v = member_pointer_index<Member>::value
inlineconstexpr

Index of the field referenced by a given pointer-to-member in its outer struct.

Template Parameters
Pointerto member to get the index of. Its object type must be an aggregate type.