30 lines
780 B
C++
30 lines
780 B
C++
#ifndef REXY_TRAITS_HPP
|
|
#define REXY_TRAITS_HPP
|
|
|
|
#include <type_traits> //is_same, decay, integral_constant, declval
|
|
|
|
namespace rexy{
|
|
|
|
template<class T, class U>
|
|
struct is_type{
|
|
static std::true_type check(U*);
|
|
static std::false_type check(...);
|
|
|
|
static constexpr bool value = std::is_same<std::true_type,decltype(check(std::declval<std::decay_t<T>*>()))>::value;
|
|
};
|
|
template<class T, template<class...> class U>
|
|
struct is_template_type_helper{
|
|
static constexpr bool value = false;
|
|
};
|
|
template<template<class...> class U, class... Args>
|
|
struct is_template_type_helper<U<Args...>,U>{
|
|
static constexpr bool value = true;
|
|
};
|
|
|
|
template<class T, template<class...> class U>
|
|
struct is_template_type : public is_template_type_helper<std::decay_t<T>,U>{};
|
|
|
|
}
|
|
|
|
#endif
|