4#include "../Foundation/PrimitiveTypes.h"
25template <
bool B,
class T =
void>
struct EnableIf {};
26template <
class T>
struct EnableIf<true, T> {
using type = T; };
29template <
typename T,
typename U>
struct IsSame {
static constexpr bool value =
false; };
30template <
typename T>
struct IsSame<T, T> {
static constexpr bool value =
true; };
34template <
class T>
struct RemovePointer<T*> {
using type = T; };
35template <
class T>
struct RemovePointer<T**> {
using type = T; };
39template <
class T>
struct AddReference<T&> {
using type = T ; };
40template <
class T>
struct AddReference<T&&> {
using type = T ; };
43template <
class T>
struct AddPointer {
using type =
typename RemoveReference<T>::type*; };
47template <
class T>
struct RemoveConst<const T> {
using type = T; };
51template <
typename R,
typename... Args>
struct ReturnType<R(Args...)> {
using type = R; };
52template <
typename R,
typename... Args>
struct ReturnType<R(*)(Args...)> {
using type = R; };
53template <
typename R,
typename C,
typename... Args>
struct ReturnType<R(C::*)(Args...)> {
using type = R; };
56template <
typename T>
struct IsConst {
using type = T;
static constexpr bool value =
false; };
57template <
typename T>
struct IsConst<const T> {
using type = T;
static constexpr bool value =
true; };
60template <
typename T>
struct IsTriviallyCopyable {
static constexpr bool value = __is_trivially_copyable(T); };
66template <
bool B,
class T,
class F>
struct Conditional {
using type = T; };
67template <
class T,
class F>
struct Conditional<false, T, F> {
using type = F; };
70template <
bool B,
class T,
class F>
using ConditionalT =
typename Conditional<B,T,F>::type;
76template <
typename T,
size_t N>
constexpr auto SizeOfArray(
const T (&)[N]) {
return N; }
84#if SC_LANGUAGE_CPP_AT_LEAST_20
85#define SC_LANGUAGE_CONSTEXPR_DESTRUCTOR constexpr
87#define SC_LANGUAGE_CONSTEXPR_DESTRUCTOR
typename Conditional< B, T, F >::type ConditionalT
ConditionalT is an alias template that resolves to type T if a boolean value is true,...
Definition: TypeTraits.h:70
constexpr auto SizeOfArray(const T(&)[N])
SizeOfArray is a constexpr function that returns the compile-time size N of a plain C array.
Definition: TypeTraits.h:76
AddPointer adds a pointer qualification to a type T if it is not already a pointer.
Definition: TypeTraits.h:43
AddReference adds a reference qualifier to a type T if it is not already a reference.
Definition: TypeTraits.h:38
Conditional defines a type to be T if a boolean value is true, F otherwise.
Definition: TypeTraits.h:66
EnableIf conditionally defines a type if a boolean template parameter is true.
Definition: TypeTraits.h:25
IsConst evaluates to true if the provided type T is const, false otherwise.
Definition: TypeTraits.h:56
Determines if a type is an lvalue reference.
Definition: Compiler.h:252
Determines if a type is an rvalue reference.
Definition: Compiler.h:255
IsReference evaluates to true if the type T is a reference, false otherwise.
Definition: TypeTraits.h:63
IsSame evaluates to true if the provided types T and U are the same, false otherwise.
Definition: TypeTraits.h:29
IsTriviallyCopyable evaluates to true if the type T can be trivially copied, false otherwise.
Definition: TypeTraits.h:60
RemoveConst removes the const qualification from a type T.
Definition: TypeTraits.h:46
RemovePointer removes the pointer qualification from a type T.
Definition: TypeTraits.h:33
ReturnType extracts the return type from different forms of function types.
Definition: TypeTraits.h:50
SameConstnessAs modifies type T to have the const-qualification of U.
Definition: TypeTraits.h:73