Files
o3de/Code/Legacy/CryCommon/MetaUtils.h
T
Esteban Papp 9f0bbf3b74 SPEC-7531 Change Code/CryEngine to Code/Legacy (#1634)
* git mv Code\CryEngine Code\Legacy
* redirecting CMakeLists.txt
* fixing uic warning
* Some more CryEngine mentions
* validation scripts

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
2021-06-29 13:51:24 -07:00

135 lines
2.2 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#ifndef CRYINCLUDE_CRYCOMMON_METAUTILS_H
#define CRYINCLUDE_CRYCOMMON_METAUTILS_H
#pragma once
namespace metautils
{
// select
template<bool Condition, typename Ty1, typename Ty2>
struct select;
template<typename Ty1, typename Ty2>
struct select<true, Ty1, Ty2>
{
typedef Ty1 type;
};
template<typename Ty1, typename Ty2>
struct select<false, Ty1, Ty2>
{
typedef Ty2 type;
};
// is_same
// Identifies whether types Ty1 and Ty2 are the same including const & volatile.
template<typename Ty1, typename Ty2>
struct is_same;
template<typename Ty1>
struct is_same<Ty1, Ty1>
{
enum
{
value = true,
};
};
template<typename Ty1, typename Ty2>
struct is_same
{
enum
{
value = false,
};
};
// remove_const
// Removes top level const qualifier.
template<class Ty>
struct remove_const
{
typedef Ty type;
};
template<class Ty>
struct remove_const<const Ty>
{
typedef Ty type;
};
template<class Ty>
struct remove_const<const Ty[]>
{
typedef Ty type[];
};
template<class Ty, unsigned int N>
struct remove_const<const Ty[N]>
{
typedef Ty type[N];
};
// is_const
// Determines whether type Ty is const qualified.
template <typename Ty>
struct is_const
{
enum
{
value = false
};
};
template <typename Ty>
struct is_const<const Ty>
{
enum
{
value = true
};
};
template<class Ty, unsigned int N>
struct is_const<Ty[N]>
{
enum
{
value = false
};
};
template<class Ty, unsigned int N>
struct is_const<const Ty[N]>
{
enum
{
value = true
};
};
template<class Ty>
struct is_const<Ty&>
{
enum
{
value = false
};
};
};
#endif // CRYINCLUDE_CRYCOMMON_METAUTILS_H