#pragma once
#include <type_traits>
namespace refl {
	template <class T>
	concept _ReflCheck_Ctor = requires { T(); };
	template <class T>
	concept _ReflCheck_UClass = requires { !std::is_void_v<decltype(T::__MakeFields())>; };
	template <class T>
	concept _ReflCheck_Ctor_NoUClass = _ReflCheck_Ctor<T> && !_ReflCheck_UClass<T>;

	// 检查类型是否具有特定的静态成员函数
	template<typename T, typename = void>
	struct has_init_object : std::false_type {};

	template<typename T>
	struct has_init_object<T, std::void_t<decltype(&T::__InitObject)>> : std::true_type {};
	
	//template<typename T>error::"expected unqualified-id"
	//using has_init_object_v = has_init_object<T>::value;

	//类型接口
	template<typename T>
	struct TypeInfoImpl;

	template<typename T>
	struct real_type {
		using type = std::remove_cv_t<T>;
	};
	template<typename T>
	struct real_type<T&> {
		using type = std::remove_cv_t<T>*;
	};
	template<typename T>
	struct real_type<T*> {
		using type = std::remove_cv_t<T>*;
	};
	template<typename T>
	using real_type_t = real_type<T>::type;

	//转化为指针类型
	template<typename T>
	struct args_type {
		using type = T;
	};
	template<typename T>
	struct args_type<T&> {
		using type = T;
	};
	template<typename T>
	struct args_type<T*> {
		using type = T;
	};
	template<typename T>
	using args_type_t = args_type<std::remove_cv_t<T>>::type;

	template<typename T>
	using TypeInfo = TypeInfoImpl<real_type_t<T>>;
}