MCRO
C++23 utilities for Unreal Engine.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
Mcro::Templates Namespace Reference

This namespace provide some introspection into template instantiations. More...

Data Structures

struct  TTemplate
 Base struct containing traits of specified template (which only accepts type parameters) More...
 

Concepts

concept  CIsTemplate
 Check if given type is an instantiation of a given template (which only accepts type parameters)
 

Typedefs

template<template< typename... > typename Template, typename Instance >
using TTemplate_Params = typename TTemplate<Template>::template Parameters<Instance>::Type
 Get template type parameters as a tuple.
 
template<template< typename... > typename Template, typename Instance >
using TTemplate_ParamsDecay = typename TTemplate<Template>::template ParametersDecay<Instance>::Type
 Get decayed template type parameters as a tuple.
 
template<template< typename... > typename Template, typename Instance , int I>
using TTemplate_Param = typename TTemplate<Template>::template Param<Instance, I>
 Get a type parameter at a specified position of a templated instance.
 
template<template< typename... > typename Template, typename Instance , int I>
using TTemplate_ParamDecay = typename TTemplate<Template>::template ParamDecay<Instance, I>
 Get a decayed type parameter at a specified position of a templated instance.
 

Functions

template<CConstType T>
auto AsConst (T &&input)
 Tired of typing const_cast<FMyLongUnwieldyTypeName>(...)? use this instead.
 
template<CMutableType T>
auto AsMutable (T &&input)
 Tired of typing const_cast<FMyLongUnwieldyTypeName>(...)? use this instead.
 
template<typename T >
auto AsConstPtr (const T *input)
 Tired of typing const_cast<FMyLongUnwieldyTypeName*>(...)? use this instead.
 
template<typename T >
auto AsConstPtr (T *input)
 Tired of typing const_cast<FMyLongUnwieldyTypeName*>(...)? use this instead.
 
template<typename T >
auto AsMutablePtr (T *input)
 Tired of typing const_cast<FMyLongUnwieldyTypeName*>(...)? use this instead.
 
template<typename T >
auto AsMutablePtr (const T *input)
 Tired of typing const_cast<FMyLongUnwieldyTypeName*>(...)? use this instead.
 

Variables

template<template< typename... > typename Template, typename Instance >
constexpr size_t TTemplate_ParamCount = TTemplate<Template>::template ParameterCount<Instance>
 Get the number of template type parameters from a specified templated instance (which only has type parameters)
 

Detailed Description

This namespace provide some introspection into template instantiations.

Warning
Members of this namespace are very limited in usage and therefore should be used with utmost care. Until this proposal https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1985r0.pdf or equivalent is considered seriously, template traits only work with templates which only have type-parameters. Non-type parameters even when a default is specified for them will result in compile error.

Typedef Documentation

◆ TTemplate_Param

template<template< typename... > typename Template, typename Instance , int I>
using Mcro::Templates::TTemplate_Param = typename TTemplate<Template>::template Param<Instance, I>

Get a type parameter at a specified position of a templated instance.

Warning
Until this proposal https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1985r0.pdf or equivalent is considered seriously, template traits only work with templates which only have type-parameters. Non-type parameters even when a default is specified for them will result in compile error.

Definition at line 115 of file Templates.h.

◆ TTemplate_ParamDecay

template<template< typename... > typename Template, typename Instance , int I>
using Mcro::Templates::TTemplate_ParamDecay = typename TTemplate<Template>::template ParamDecay<Instance, I>

Get a decayed type parameter at a specified position of a templated instance.

Warning
Until this proposal https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1985r0.pdf or equivalent is considered seriously, template traits only work with templates which only have type-parameters. Non-type parameters even when a default is specified for them will result in compile error.

Definition at line 126 of file Templates.h.

◆ TTemplate_Params

template<template< typename... > typename Template, typename Instance >
using Mcro::Templates::TTemplate_Params = typename TTemplate<Template>::template Parameters<Instance>::Type

Get template type parameters as a tuple.

Warning
Until this proposal https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1985r0.pdf or equivalent is considered seriously, template traits only work with templates which only have type-parameters. Non-type parameters even when a default is specified for them will result in compile error.

Definition at line 93 of file Templates.h.

◆ TTemplate_ParamsDecay

template<template< typename... > typename Template, typename Instance >
using Mcro::Templates::TTemplate_ParamsDecay = typename TTemplate<Template>::template ParametersDecay<Instance>::Type

Get decayed template type parameters as a tuple.

Warning
Until this proposal https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1985r0.pdf or equivalent is considered seriously, template traits only work with templates which only have type-parameters. Non-type parameters even when a default is specified for them will result in compile error.

Definition at line 104 of file Templates.h.

Function Documentation

◆ AsConst()

template<CConstType T>
auto Mcro::Templates::AsConst ( T && input)

Tired of typing const_cast<FMyLongUnwieldyTypeName>(...)? use this instead.

Definition at line 153 of file Templates.h.

◆ AsConstPtr() [1/2]

template<typename T >
auto Mcro::Templates::AsConstPtr ( const T * input)

Tired of typing const_cast<FMyLongUnwieldyTypeName*>(...)? use this instead.

Definition at line 169 of file Templates.h.

◆ AsConstPtr() [2/2]

template<typename T >
auto Mcro::Templates::AsConstPtr ( T * input)

Tired of typing const_cast<FMyLongUnwieldyTypeName*>(...)? use this instead.

Definition at line 173 of file Templates.h.

◆ AsMutable()

template<CMutableType T>
auto Mcro::Templates::AsMutable ( T && input)

Tired of typing const_cast<FMyLongUnwieldyTypeName>(...)? use this instead.

Definition at line 161 of file Templates.h.

◆ AsMutablePtr() [1/2]

template<typename T >
auto Mcro::Templates::AsMutablePtr ( const T * input)

Tired of typing const_cast<FMyLongUnwieldyTypeName*>(...)? use this instead.

Definition at line 181 of file Templates.h.

◆ AsMutablePtr() [2/2]

template<typename T >
auto Mcro::Templates::AsMutablePtr ( T * input)

Tired of typing const_cast<FMyLongUnwieldyTypeName*>(...)? use this instead.

Definition at line 177 of file Templates.h.

Variable Documentation

◆ TTemplate_ParamCount

template<template< typename... > typename Template, typename Instance >
size_t Mcro::Templates::TTemplate_ParamCount = TTemplate<Template>::template ParameterCount<Instance>
inlineconstexpr

Get the number of template type parameters from a specified templated instance (which only has type parameters)

Warning
Until this proposal https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1985r0.pdf or equivalent is considered seriously, template traits only work with templates which only have type-parameters. Non-type parameters even when a default is specified for them will result in compile error.

Definition at line 149 of file Templates.h.