Mountain  1.0.0
Simple C++ 2D Game Framework
meta_programming.hpp File Reference

Defines utilities for meta programming and template manipulation. More...

#include "Mountain/core.hpp"
#include <map>
#include <type_traits>
#include <Maths/quaternion.hpp>
#include <Maths/vector2.hpp>
#include <Maths/vector3.hpp>
#include "Mountain/utils/concepts.hpp"
+ Include dependency graph for meta_programming.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Mountain::Pointer< T >
 Custom Mountain smart pointer. Represents both a std::shared_ptr and a std::weak_ptr. More...
 
class  Mountain::List< T >
 A dynamic array implementation. Wrapper around the std::vector class. More...
 

Namespaces

 Mountain
 Contains all declarations of the Mountain Framework.
 
 Meta
 Defines utilities for meta programming and template manipulation.
 

Typedefs

template<bool_t Test>
using Mountain::Meta::EnableIf = std::enable_if_t< Test >
 
template<typename T >
using Mountain::Meta::RemoveArraySpecifier = std::remove_extent_t< T >
 Removes the array specification from T. More...
 
template<typename T >
using Mountain::Meta::RemovePointerSpecifier = std::remove_pointer_t< T >
 Removes the pointer specification from T. More...
 
template<typename T >
using Mountain::Meta::RemoveConstSpecifier = std::remove_const_t< T >
 Removes the const specification from T. More...
 
template<Concepts::EnumT T>
using Mountain::Meta::UnderlyingEnumType = std::underlying_type_t< T >
 
template<Concepts::EnumT T>
using Mountain::Meta::Flags = UnderlyingEnumType< T >
 

Variables

template<typename Base , typename Derived >
constexpr bool_t Mountain::Meta::IsBaseOf = std::is_base_of_v<Base, Derived>
 Checks whether Derived is a derived class of Base. More...
 
template<typename A , typename B >
constexpr bool_t Mountain::Meta::IsSame = std::is_same_v<A, B>
 Checks whether A and B are the same type. More...
 
template<typename T , typename... Other>
constexpr bool_t Mountain::Meta::IsAny = (std::is_same_v<T, Other> || ...)
 Checks whether T is any of the provided types in Other. More...
 
template<typename T >
constexpr bool_t Mountain::Meta::IsArray = std::is_array_v<T>
 Checks whether T is an array. More...
 
template<typename T >
constexpr bool_t Mountain::Meta::IsPointer = std::is_pointer_v<T>
 Checks whether T is a pointer. More...
 
template<typename T >
constexpr bool_t Mountain::Meta::IsClass = std::is_class_v<T>
 Checks whether T is a class. More...
 
template<typename T >
constexpr bool_t Mountain::Meta::IsEnum = std::is_enum_v<T>
 Checks whether T is an enum. More...
 
template<typename T >
constexpr bool_t Mountain::Meta::IsIntegral = std::is_integral_v<T>
 Checks whether T is an integral type. More...
 
template<typename T >
constexpr bool_t Mountain::Meta::IsFloatingPoint = std::is_floating_point_v<T>
 Checks whether T is a floating type. More...
 
template<typename T >
constexpr bool_t Mountain::Meta::IsAbstract = std::is_abstract_v<T>
 Checks whether T is an abstract class. More...
 
template<typename T >
constexpr bool_t Mountain::Meta::IsDefaultConstructible = std::is_default_constructible_v<T>
 Checks whether T is default constructible (has a public constructor, with no parameters) More...
 
template<typename T >
constexpr bool_t Mountain::Meta::IsCopyAssignable = std::is_copy_assignable_v<T>
 Checks whether T can be copied without semantics. More...
 
template<typename >
constexpr bool_t Mountain::Meta::IsStdVector = false
 Checks whether the type is a std::vector.
 
template<typename >
constexpr bool_t Mountain::Meta::IsStdFunction = false
 Checks whether the type is a std::vector.
 
template<typename >
constexpr bool_t Mountain::Meta::IsStdMap = false
 Checks whether the type is a std::vector.
 
template<typename >
constexpr bool_t Mountain::Meta::IsMountainList = false
 Checks whether the type is a List.
 
template<typename T >
constexpr bool_t Mountain::Meta::IsMountainList< List< T > > = true
 
template<typename >
constexpr bool_t Mountain::Meta::IsMountainPointer = false
 Checks whether the type is a Pointer.
 
template<typename T >
constexpr bool_t Mountain::Meta::IsNativeType = IsAny<T, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float_t, double_t, bool_t>
 Checks if T is a native type. More...
 
template<typename T >
constexpr bool_t Mountain::Meta::IsIntegralOrFloating = IsAny<T, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float_t, double_t>
 Checks if T is an integral or a floating type. More...
 
template<typename T >
constexpr bool_t Mountain::Meta::IsMathType = IsAny<T, Vector2, Vector2i, Vector3, Vector4, Quaternion>
 Checks if T is a math type. More...
 
template<typename T >
constexpr bool_t Mountain::Meta::IsColorType = IsAny<T, Color, ColorHsva>
 Checks if T is a color type. More...
 

Detailed Description

Defines utilities for meta programming and template manipulation.

Definition in file meta_programming.hpp.

Typedef Documentation

◆ RemoveArraySpecifier

template<typename T >
using Mountain::Meta::RemoveArraySpecifier = typedef std::remove_extent_t<T>

Removes the array specification from T.

e.g. if T was int[4], then RemoveArraySpecifier<T> will be int

Definition at line 102 of file meta_programming.hpp.

◆ RemoveConstSpecifier

template<typename T >
using Mountain::Meta::RemoveConstSpecifier = typedef std::remove_const_t<T>

Removes the const specification from T.

e.g. if T was const int, then RemoveConstSpecifier<T> will be int

Definition at line 116 of file meta_programming.hpp.

◆ RemovePointerSpecifier

template<typename T >
using Mountain::Meta::RemovePointerSpecifier = typedef std::remove_pointer_t<T>

Removes the pointer specification from T.

e.g. if T was int*, then RemovePointerSpecifier<T> will be int

Definition at line 109 of file meta_programming.hpp.

Variable Documentation

◆ IsAbstract

template<typename T >
constexpr bool_t Mountain::Meta::IsAbstract = std::is_abstract_v<T>

Checks whether T is an abstract class.

Template Parameters
TType

Definition at line 82 of file meta_programming.hpp.

◆ IsAny

template<typename T , typename... Other>
constexpr bool_t Mountain::Meta::IsAny = (std::is_same_v<T, Other> || ...)

Checks whether T is any of the provided types in Other.

Template Parameters
TType
OtherOther types

Definition at line 47 of file meta_programming.hpp.

◆ IsArray

template<typename T >
constexpr bool_t Mountain::Meta::IsArray = std::is_array_v<T>

Checks whether T is an array.

Template Parameters
TType

Definition at line 52 of file meta_programming.hpp.

◆ IsBaseOf

template<typename Base , typename Derived >
constexpr bool_t Mountain::Meta::IsBaseOf = std::is_base_of_v<Base, Derived>

Checks whether Derived is a derived class of Base.

Template Parameters
BaseBase class
DerivedDerived class

Definition at line 35 of file meta_programming.hpp.

◆ IsClass

template<typename T >
constexpr bool_t Mountain::Meta::IsClass = std::is_class_v<T>

Checks whether T is a class.

Template Parameters
TType

Definition at line 62 of file meta_programming.hpp.

◆ IsColorType

template<typename T >
constexpr bool_t Mountain::Meta::IsColorType = IsAny<T, Color, ColorHsva>

Checks if T is a color type.

A color type is one of the following types:

  • Color
  • ColorHsva
Template Parameters
TType

Definition at line 208 of file meta_programming.hpp.

◆ IsCopyAssignable

template<typename T >
constexpr bool_t Mountain::Meta::IsCopyAssignable = std::is_copy_assignable_v<T>

Checks whether T can be copied without semantics.

Template Parameters
TType

Definition at line 92 of file meta_programming.hpp.

◆ IsDefaultConstructible

template<typename T >
constexpr bool_t Mountain::Meta::IsDefaultConstructible = std::is_default_constructible_v<T>

Checks whether T is default constructible (has a public constructor, with no parameters)

Template Parameters
TType

Definition at line 87 of file meta_programming.hpp.

◆ IsEnum

template<typename T >
constexpr bool_t Mountain::Meta::IsEnum = std::is_enum_v<T>

Checks whether T is an enum.

Template Parameters
TType

Definition at line 67 of file meta_programming.hpp.

◆ IsFloatingPoint

template<typename T >
constexpr bool_t Mountain::Meta::IsFloatingPoint = std::is_floating_point_v<T>

Checks whether T is a floating type.

Template Parameters
TType

Definition at line 77 of file meta_programming.hpp.

◆ IsIntegral

template<typename T >
constexpr bool_t Mountain::Meta::IsIntegral = std::is_integral_v<T>

Checks whether T is an integral type.

Template Parameters
TType

Definition at line 72 of file meta_programming.hpp.

◆ IsIntegralOrFloating

template<typename T >
constexpr bool_t Mountain::Meta::IsIntegralOrFloating = IsAny<T, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float_t, double_t>

Checks if T is an integral or a floating type.

A int/float type is one of the following types:

  • uint8_t
  • int8_t
  • uint16_t
  • int16_t
  • uint32_t
  • int32_t
  • float_t
  • double_t
Template Parameters
TType

Definition at line 185 of file meta_programming.hpp.

◆ IsMathType

template<typename T >
constexpr bool_t Mountain::Meta::IsMathType = IsAny<T, Vector2, Vector2i, Vector3, Vector4, Quaternion>

Checks if T is a math type.

A math type is one of the following types:

Template Parameters
TType

Definition at line 198 of file meta_programming.hpp.

◆ IsNativeType

template<typename T >
constexpr bool_t Mountain::Meta::IsNativeType = IsAny<T, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float_t, double_t, bool_t>

Checks if T is a native type.

A native type is one of the following types:

  • uint8_t
  • int8_t
  • uint16_t
  • int16_t
  • uint32_t
  • int32_t
  • float_t
  • double_t
  • bool_t_t
Template Parameters
TType

Definition at line 169 of file meta_programming.hpp.

◆ IsPointer

template<typename T >
constexpr bool_t Mountain::Meta::IsPointer = std::is_pointer_v<T>

Checks whether T is a pointer.

Template Parameters
TType

Definition at line 57 of file meta_programming.hpp.

◆ IsSame

template<typename A , typename B >
constexpr bool_t Mountain::Meta::IsSame = std::is_same_v<A, B>

Checks whether A and B are the same type.

Template Parameters
AFirst type
BSecond type

Definition at line 41 of file meta_programming.hpp.