LearnWithTouch/App/LearnWithTouch_ios/Libraries/libil2cpp/include/utils/TemplateUtils.h

47 lines
871 B
C
Raw Normal View History

2019-07-01 14:33:21 +02:00
#pragma once
#include <stdint.h>
namespace il2cpp
{
namespace utils
{
namespace TemplateUtils
{
template<typename T, typename U>
struct IsSame
{
static const bool value = false;
};
template<typename T>
struct IsSame<T, T>
{
static const bool value = true;
};
template<typename B, typename D>
struct IsBaseOf
{
private:
template<typename BT, typename DT>
struct Converter
{
operator BT*() const;
operator DT*();
};
typedef int16_t Derived;
typedef int8_t NotDerived;
template<typename T>
static Derived IsDerived(D*, T);
static NotDerived IsDerived(B*, int);
public:
static const bool value = IsSame<B, D>::value || sizeof(IsDerived(Converter<B, D>(), int())) == sizeof(Derived);
};
}
}
}