mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-15 03:45:30 +07:00
hide type_id ctor
This commit is contained in:
@@ -85,7 +85,7 @@ namespace meta_hpp
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Class, typename... Args >
|
||||
inline ctor_info::ctor_info(typename_arg_t<Class>, typename_arg_t<Args...>)
|
||||
ctor_info::ctor_info(typename_arg_t<Class>, typename_arg_t<Args...>)
|
||||
: state_{std::make_shared<state>(state{
|
||||
ctor_type{typename_arg<Class>, typename_arg<Args...>},
|
||||
{}
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace meta_hpp
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Enum >
|
||||
inline enum_info::enum_info(typename_arg_t<Enum>, std::string name)
|
||||
enum_info::enum_info(typename_arg_t<Enum>, std::string name)
|
||||
: state_{std::make_shared<state>(state{
|
||||
std::move(name),
|
||||
type_db::get<Enum>().template as<enum_type>(),
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace meta_hpp
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Enum >
|
||||
inline evalue_info::evalue_info(std::string name, Enum value)
|
||||
evalue_info::evalue_info(std::string name, Enum value)
|
||||
: state_{std::make_shared<state>(state{
|
||||
std::move(name),
|
||||
std::move(value),
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace meta_hpp
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Function >
|
||||
inline function_info::function_info(std::string name, Function instance)
|
||||
function_info::function_info(std::string name, Function instance)
|
||||
: state_{std::make_shared<state>(state{
|
||||
std::move(name),
|
||||
type_db::get<Function>().template as<function_type>(),
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace meta_hpp
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Member >
|
||||
inline member_info::member_info(std::string name, Member instance)
|
||||
member_info::member_info(std::string name, Member instance)
|
||||
: state_{std::make_shared<state>(state{
|
||||
std::move(name),
|
||||
type_db::get<Member>().template as<member_type>(),
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace meta_hpp
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Method >
|
||||
inline method_info::method_info(std::string name, Method instance)
|
||||
method_info::method_info(std::string name, Method instance)
|
||||
: state_{std::make_shared<state>(state{
|
||||
std::move(name),
|
||||
type_db::get<Method>().template as<method_type>(),
|
||||
|
||||
@@ -56,11 +56,11 @@ namespace meta_hpp
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Class >
|
||||
inline class_<Class>::class_(std::string name)
|
||||
class_<Class>::class_(std::string name)
|
||||
: name_{std::move(name)} {}
|
||||
|
||||
template < typename Class >
|
||||
inline class_info class_<Class>::make_info() const {
|
||||
class_info class_<Class>::make_info() const {
|
||||
class_info info{typename_arg<Class>, name_};
|
||||
info.state_->classes.insert(classes_.begin(), classes_.end());
|
||||
info.state_->ctors.insert(ctors_.begin(), ctors_.end());
|
||||
@@ -74,7 +74,7 @@ namespace meta_hpp
|
||||
|
||||
template < typename Class >
|
||||
template < typename... Internals >
|
||||
inline class_<Class>& class_<Class>::operator()(Internals&&...internals) {
|
||||
class_<Class>& class_<Class>::operator()(Internals&&...internals) {
|
||||
(add_(std::forward<Internals>(internals)), ...);
|
||||
return *this;
|
||||
}
|
||||
@@ -84,48 +84,48 @@ namespace meta_hpp
|
||||
{
|
||||
template < typename Class >
|
||||
template < typename Class2 >
|
||||
inline void class_<Class>::add_(const class_<Class2>& internal) {
|
||||
void class_<Class>::add_(const class_<Class2>& internal) {
|
||||
auto info = internal.make_info();
|
||||
detail::merge_with(classes_, info.name(), info, &class_info::merge);
|
||||
}
|
||||
|
||||
template < typename Class >
|
||||
template < typename... Args >
|
||||
inline void class_<Class>::add_(const ctor_<Args...>& internal) {
|
||||
void class_<Class>::add_(const ctor_<Args...>& internal) {
|
||||
auto info = internal.template make_info<Class>();
|
||||
detail::merge_with(ctors_, info.type().id(), info, &ctor_info::merge);
|
||||
}
|
||||
|
||||
template < typename Class >
|
||||
inline void class_<Class>::add_(const data_& internal) {
|
||||
void class_<Class>::add_(const data_& internal) {
|
||||
auto info = internal.make_info();
|
||||
detail::merge_with(datas_, info.name(), info, &data_info::merge);
|
||||
}
|
||||
|
||||
template < typename Class >
|
||||
template < typename Enum >
|
||||
inline void class_<Class>::add_(const enum_<Enum>& internal) {
|
||||
void class_<Class>::add_(const enum_<Enum>& internal) {
|
||||
auto info = internal.make_info();
|
||||
detail::merge_with(enums_, info.name(), info, &enum_info::merge);
|
||||
}
|
||||
|
||||
template < typename Class >
|
||||
template < typename Function >
|
||||
inline void class_<Class>::add_(const function_<Function>& internal) {
|
||||
void class_<Class>::add_(const function_<Function>& internal) {
|
||||
auto info = internal.make_info();
|
||||
detail::merge_with(functions_, info.name(), info, &function_info::merge);
|
||||
}
|
||||
|
||||
template < typename Class >
|
||||
template < typename Member >
|
||||
inline void class_<Class>::add_(const member_<Member>& internal) {
|
||||
void class_<Class>::add_(const member_<Member>& internal) {
|
||||
auto info = internal.make_info();
|
||||
detail::merge_with(members_, info.name(), info, &member_info::merge);
|
||||
}
|
||||
|
||||
template < typename Class >
|
||||
template < typename Method >
|
||||
inline void class_<Class>::add_(const method_<Method>& internal) {
|
||||
void class_<Class>::add_(const method_<Method>& internal) {
|
||||
auto info = internal.make_info();
|
||||
detail::merge_with(methods_, info.name(), info, &method_info::merge);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace meta_hpp
|
||||
{
|
||||
template < typename... Args >
|
||||
template < typename Class >
|
||||
inline ctor_info ctor_<Args...>::make_info() const {
|
||||
ctor_info ctor_<Args...>::make_info() const {
|
||||
ctor_info info{typename_arg<Class>, typename_arg<Args...>};
|
||||
info.state_->datas.insert(datas_.begin(), datas_.end());
|
||||
return info;
|
||||
@@ -42,7 +42,7 @@ namespace meta_hpp
|
||||
|
||||
template < typename... Args >
|
||||
template < typename... Internals >
|
||||
inline ctor_<Args...>& ctor_<Args...>::operator()(Internals&&...internals) {
|
||||
ctor_<Args...>& ctor_<Args...>::operator()(Internals&&...internals) {
|
||||
(add_(std::forward<Internals>(internals)), ...);
|
||||
return *this;
|
||||
}
|
||||
@@ -51,7 +51,7 @@ namespace meta_hpp
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename... Args >
|
||||
inline void ctor_<Args...>::add_(const data_& internal) {
|
||||
void ctor_<Args...>::add_(const data_& internal) {
|
||||
auto info = internal.make_info();
|
||||
detail::merge_with(datas_, info.name(), info, &data_info::merge);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace meta_hpp
|
||||
}
|
||||
|
||||
template < typename... Internals >
|
||||
inline data_& data_::operator()(Internals&&...internals) {
|
||||
data_& data_::operator()(Internals&&...internals) {
|
||||
(add_(std::forward<Internals>(internals)), ...);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -36,11 +36,11 @@ namespace meta_hpp
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Enum >
|
||||
inline enum_<Enum>::enum_(std::string name)
|
||||
enum_<Enum>::enum_(std::string name)
|
||||
: name_{std::move(name)} {}
|
||||
|
||||
template < typename Enum >
|
||||
inline enum_info enum_<Enum>::make_info() const {
|
||||
enum_info enum_<Enum>::make_info() const {
|
||||
enum_info info{typename_arg<Enum>, name_};
|
||||
info.state_->datas.insert(datas_.begin(), datas_.end());
|
||||
info.state_->evalues.insert(evalues_.begin(), evalues_.end());
|
||||
@@ -49,7 +49,7 @@ namespace meta_hpp
|
||||
|
||||
template < typename Enum >
|
||||
template < typename... Internals >
|
||||
inline enum_<Enum>& enum_<Enum>::operator()(Internals&&...internals) {
|
||||
enum_<Enum>& enum_<Enum>::operator()(Internals&&...internals) {
|
||||
(add_(std::forward<Internals>(internals)), ...);
|
||||
return *this;
|
||||
}
|
||||
@@ -58,13 +58,13 @@ namespace meta_hpp
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Enum >
|
||||
inline void enum_<Enum>::add_(const data_& internal) {
|
||||
void enum_<Enum>::add_(const data_& internal) {
|
||||
auto info = internal.make_info();
|
||||
detail::merge_with(datas_, info.name(), info, &data_info::merge);
|
||||
}
|
||||
|
||||
template < typename Enum >
|
||||
inline void enum_<Enum>::add_(const evalue_<Enum>& internal) {
|
||||
void enum_<Enum>::add_(const evalue_<Enum>& internal) {
|
||||
auto info = internal.make_info();
|
||||
detail::merge_with(evalues_, info.name(), info, &evalue_info::merge);
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ namespace meta_hpp
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Enum >
|
||||
inline evalue_<Enum>::evalue_(std::string name, Enum value)
|
||||
evalue_<Enum>::evalue_(std::string name, Enum value)
|
||||
: name_{std::move(name)}
|
||||
, value_{std::move(value)} {}
|
||||
|
||||
template < typename Enum >
|
||||
inline evalue_info evalue_<Enum>::make_info() const {
|
||||
evalue_info evalue_<Enum>::make_info() const {
|
||||
evalue_info info{name_, value_};
|
||||
info.state_->datas.insert(datas_.begin(), datas_.end());
|
||||
return info;
|
||||
@@ -47,7 +47,7 @@ namespace meta_hpp
|
||||
|
||||
template < typename Enum >
|
||||
template < typename... Internals >
|
||||
inline evalue_<Enum>& evalue_<Enum>::operator()(Internals&&...internals) {
|
||||
evalue_<Enum>& evalue_<Enum>::operator()(Internals&&...internals) {
|
||||
(add_(std::forward<Internals>(internals)), ...);
|
||||
return *this;
|
||||
}
|
||||
@@ -56,7 +56,7 @@ namespace meta_hpp
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Enum >
|
||||
inline void evalue_<Enum>::add_(const data_& internal) {
|
||||
void evalue_<Enum>::add_(const data_& internal) {
|
||||
auto info = internal.make_info();
|
||||
detail::merge_with(datas_, info.name(), info, &data_info::merge);
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ namespace meta_hpp
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Function >
|
||||
inline function_<Function>::function_(std::string name, Function instance)
|
||||
function_<Function>::function_(std::string name, Function instance)
|
||||
: name_{std::move(name)}
|
||||
, instance_{std::move(instance)} {}
|
||||
|
||||
template < typename Function >
|
||||
inline function_info function_<Function>::make_info() const {
|
||||
function_info function_<Function>::make_info() const {
|
||||
function_info info{name_, instance_};
|
||||
info.state_->datas.insert(datas_.begin(), datas_.end());
|
||||
return info;
|
||||
@@ -47,7 +47,7 @@ namespace meta_hpp
|
||||
|
||||
template < typename Function >
|
||||
template < typename... Internals >
|
||||
inline function_<Function>& function_<Function>::operator()(Internals&&...internals) {
|
||||
function_<Function>& function_<Function>::operator()(Internals&&...internals) {
|
||||
(add_(std::forward<Internals>(internals)), ...);
|
||||
return *this;
|
||||
}
|
||||
@@ -56,7 +56,7 @@ namespace meta_hpp
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Function >
|
||||
inline void function_<Function>::add_(const data_& internal) {
|
||||
void function_<Function>::add_(const data_& internal) {
|
||||
auto info = internal.make_info();
|
||||
detail::merge_with(datas_, info.name(), info, &data_info::merge);
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ namespace meta_hpp
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Member >
|
||||
inline member_<Member>::member_(std::string name, Member instance)
|
||||
member_<Member>::member_(std::string name, Member instance)
|
||||
: name_{std::move(name)}
|
||||
, instance_{std::move(instance)} {}
|
||||
|
||||
template < typename Member >
|
||||
inline member_info member_<Member>::make_info() const {
|
||||
member_info member_<Member>::make_info() const {
|
||||
member_info info{name_, instance_};
|
||||
info.state_->datas.insert(datas_.begin(), datas_.end());
|
||||
return info;
|
||||
@@ -47,7 +47,7 @@ namespace meta_hpp
|
||||
|
||||
template < typename Member >
|
||||
template < typename... Internals >
|
||||
inline member_<Member>& member_<Member>::operator()(Internals&&...internals) {
|
||||
member_<Member>& member_<Member>::operator()(Internals&&...internals) {
|
||||
(add_(std::forward<Internals>(internals)), ...);
|
||||
return *this;
|
||||
}
|
||||
@@ -56,7 +56,7 @@ namespace meta_hpp
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Member >
|
||||
inline void member_<Member>::add_(const data_& internal) {
|
||||
void member_<Member>::add_(const data_& internal) {
|
||||
auto info = internal.make_info();
|
||||
detail::merge_with(datas_, info.name(), info, &data_info::merge);
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ namespace meta_hpp
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Method >
|
||||
inline method_<Method>::method_(std::string name, Method instance)
|
||||
method_<Method>::method_(std::string name, Method instance)
|
||||
: name_{std::move(name)}
|
||||
, instance_{std::move(instance)} {}
|
||||
|
||||
template < typename Method >
|
||||
inline method_info method_<Method>::make_info() const {
|
||||
method_info method_<Method>::make_info() const {
|
||||
method_info info{name_, instance_};
|
||||
info.state_->datas.insert(datas_.begin(), datas_.end());
|
||||
return info;
|
||||
@@ -47,7 +47,7 @@ namespace meta_hpp
|
||||
|
||||
template < typename Method >
|
||||
template < typename... Internals >
|
||||
inline method_<Method>& method_<Method>::operator()(Internals&&...internals) {
|
||||
method_<Method>& method_<Method>::operator()(Internals&&...internals) {
|
||||
(add_(std::forward<Internals>(internals)), ...);
|
||||
return *this;
|
||||
}
|
||||
@@ -56,7 +56,7 @@ namespace meta_hpp
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Method >
|
||||
inline void method_<Method>::add_(const data_& internal) {
|
||||
void method_<Method>::add_(const data_& internal) {
|
||||
auto info = internal.make_info();
|
||||
detail::merge_with(datas_, info.name(), info, &data_info::merge);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace meta_hpp
|
||||
}
|
||||
|
||||
template < typename... Internals >
|
||||
inline namespace_& namespace_::operator()(Internals&&...internals) {
|
||||
namespace_& namespace_::operator()(Internals&&...internals) {
|
||||
(add_(std::forward<Internals>(internals)), ...);
|
||||
return *this;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ namespace meta_hpp
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Class >
|
||||
inline void namespace_::add_(const class_<Class>& internal) {
|
||||
void namespace_::add_(const class_<Class>& internal) {
|
||||
auto info = internal.make_info();
|
||||
detail::merge_with(classes_, info.name(), info, &class_info::merge);
|
||||
}
|
||||
@@ -79,13 +79,13 @@ namespace meta_hpp
|
||||
}
|
||||
|
||||
template < typename Enum >
|
||||
inline void namespace_::add_(const enum_<Enum>& internal) {
|
||||
void namespace_::add_(const enum_<Enum>& internal) {
|
||||
auto info = internal.make_info();
|
||||
detail::merge_with(enums_, info.name(), info, &enum_info::merge);
|
||||
}
|
||||
|
||||
template < typename Function >
|
||||
inline void namespace_::add_(const function_<Function>& internal) {
|
||||
void namespace_::add_(const function_<Function>& internal) {
|
||||
auto info = internal.make_info();
|
||||
detail::merge_with(functions_, info.name(), info, &function_info::merge);
|
||||
}
|
||||
|
||||
@@ -20,10 +20,6 @@ namespace meta_hpp
|
||||
type_id(const type_id&) = default;
|
||||
type_id& operator=(const type_id&) = default;
|
||||
|
||||
template < typename T >
|
||||
explicit type_id(typename_arg_t<T>) noexcept
|
||||
: id_{type_to_id<T>()} {}
|
||||
|
||||
explicit operator bool() const noexcept {
|
||||
return !!id_;
|
||||
}
|
||||
@@ -47,6 +43,12 @@ namespace meta_hpp
|
||||
using underlying_type = std::size_t;
|
||||
underlying_type id_{0u};
|
||||
private:
|
||||
friend class type_base;
|
||||
|
||||
template < typename T >
|
||||
explicit type_id(typename_arg_t<T>) noexcept
|
||||
: id_{type_to_id<T>()} {}
|
||||
|
||||
static underlying_type next() noexcept {
|
||||
static std::atomic<underlying_type> id{};
|
||||
return ++id;
|
||||
@@ -86,10 +88,6 @@ namespace meta_hpp
|
||||
type_base(const type_base&) = default;
|
||||
type_base& operator=(const type_base&) = default;
|
||||
|
||||
template < typename... Ts >
|
||||
explicit type_base(typename_arg_t<Ts...>)
|
||||
: id_{typename_arg<tag<Ts...>>} {}
|
||||
|
||||
type_id id() const noexcept {
|
||||
return id_;
|
||||
}
|
||||
@@ -97,6 +95,10 @@ namespace meta_hpp
|
||||
explicit operator bool() const noexcept {
|
||||
return !!id_;
|
||||
}
|
||||
protected:
|
||||
template < typename... Ts >
|
||||
explicit type_base(typename_arg_t<Ts...>)
|
||||
: id_{typename_arg<tag<Ts...>>} {}
|
||||
private:
|
||||
type_id id_;
|
||||
};
|
||||
|
||||
@@ -85,8 +85,8 @@ namespace meta_hpp
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
inline arithmetic_type::arithmetic_type(typename_arg_t<T>)
|
||||
: type_base{typename_arg<T>}
|
||||
arithmetic_type::arithmetic_type(typename_arg_t<T>)
|
||||
: type_base{typename_arg<struct arithmetic_type_tag, T>}
|
||||
, state_{std::make_shared<state>(state{
|
||||
detail::arithmetic_traits<T>::size,
|
||||
detail::arithmetic_traits<T>::make_raw_type(),
|
||||
|
||||
@@ -88,8 +88,8 @@ namespace meta_hpp::detail
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename T >
|
||||
inline array_type::array_type(typename_arg_t<T>)
|
||||
: type_base{typename_arg<T>}
|
||||
array_type::array_type(typename_arg_t<T>)
|
||||
: type_base{typename_arg<struct array_type_tag, T>}
|
||||
, state_{std::make_shared<state>(state{
|
||||
detail::array_traits<T>::extent,
|
||||
detail::array_traits<T>::make_data_type(),
|
||||
|
||||
@@ -85,8 +85,8 @@ namespace meta_hpp
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
inline class_type::class_type(typename_arg_t<T>)
|
||||
: type_base{typename_arg<T>}
|
||||
class_type::class_type(typename_arg_t<T>)
|
||||
: type_base{typename_arg<struct class_type_tag, T>}
|
||||
, state_{std::make_shared<state>(state{
|
||||
detail::class_traits<T>::size,
|
||||
detail::class_traits<T>::make_raw_type(),
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace meta_hpp
|
||||
};
|
||||
|
||||
template < typename Class, typename... Args >
|
||||
inline ctor_type::ctor_type(typename_arg_t<Class>, typename_arg_t<Args...>)
|
||||
ctor_type::ctor_type(typename_arg_t<Class>, typename_arg_t<Args...>)
|
||||
: type_base{typename_arg<struct ctor_type_tag, Class, Args...>}
|
||||
, state_{std::make_shared<state>(state{
|
||||
detail::ctor_traits<Class, Args...>::arity,
|
||||
|
||||
@@ -76,8 +76,8 @@ namespace meta_hpp
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
inline enum_type::enum_type(typename_arg_t<T>)
|
||||
: type_base{typename_arg<T>}
|
||||
enum_type::enum_type(typename_arg_t<T>)
|
||||
: type_base{typename_arg<struct enum_type_tag, T>}
|
||||
, state_{std::make_shared<state>(state{
|
||||
detail::enum_traits<T>::make_raw_type(),
|
||||
detail::enum_traits<T>::make_underlying_type(),
|
||||
|
||||
@@ -84,8 +84,8 @@ namespace meta_hpp
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
inline function_type::function_type(typename_arg_t<T>)
|
||||
: type_base{typename_arg<T>}
|
||||
function_type::function_type(typename_arg_t<T>)
|
||||
: type_base{typename_arg<struct function_type_tag, T>}
|
||||
, state_{std::make_shared<state>(state{
|
||||
detail::function_pointer_traits<T>::arity,
|
||||
detail::function_pointer_traits<T>::make_return_type(),
|
||||
|
||||
@@ -61,8 +61,8 @@ namespace meta_hpp::detail
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename T >
|
||||
inline member_type::member_type(typename_arg_t<T>)
|
||||
: type_base{typename_arg<T>}
|
||||
member_type::member_type(typename_arg_t<T>)
|
||||
: type_base{typename_arg<struct member_type_tag, T>}
|
||||
, state_{std::make_shared<state>(state{
|
||||
detail::member_pointer_traits<T>::make_class_type(),
|
||||
detail::member_pointer_traits<T>::make_value_type(),
|
||||
|
||||
@@ -107,8 +107,8 @@ namespace meta_hpp
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
inline method_type::method_type(typename_arg_t<T>)
|
||||
: type_base{typename_arg<T>}
|
||||
method_type::method_type(typename_arg_t<T>)
|
||||
: type_base{typename_arg<struct member_type_tag, T>}
|
||||
, state_{std::make_shared<state>(state{
|
||||
detail::method_pointer_traits<T>::arity,
|
||||
detail::method_pointer_traits<T>::make_class_type(),
|
||||
|
||||
@@ -75,8 +75,8 @@ namespace meta_hpp
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
inline pointer_type::pointer_type(typename_arg_t<T>)
|
||||
: type_base{typename_arg<T>}
|
||||
pointer_type::pointer_type(typename_arg_t<T>)
|
||||
: type_base{typename_arg<struct pointer_type_tag, T>}
|
||||
, state_{std::make_shared<state>(state{
|
||||
detail::pointer_traits<T>::make_data_type(),
|
||||
detail::pointer_traits<T>::make_flags(),
|
||||
|
||||
@@ -79,8 +79,8 @@ namespace meta_hpp
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
inline reference_type::reference_type(typename_arg_t<T>)
|
||||
: type_base{typename_arg<T>}
|
||||
reference_type::reference_type(typename_arg_t<T>)
|
||||
: type_base{typename_arg<struct reference_type_tag, T>}
|
||||
, state_{std::make_shared<state>(state{
|
||||
detail::reference_traits<T>::make_data_type(),
|
||||
detail::reference_traits<T>::make_flags(),
|
||||
|
||||
@@ -72,8 +72,8 @@ namespace meta_hpp::detail
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename T >
|
||||
inline void_type::void_type(typename_arg_t<T>)
|
||||
: type_base{typename_arg<T>}
|
||||
void_type::void_type(typename_arg_t<T>)
|
||||
: type_base{typename_arg<struct void_type_tag, T>}
|
||||
, state_{std::make_shared<state>(state{
|
||||
detail::void_traits<T>::make_raw_type(),
|
||||
detail::void_traits<T>::make_flags(),
|
||||
|
||||
@@ -20,7 +20,6 @@ TEST_CASE("features/types/arithmetic") {
|
||||
REQUIRE(type_db::get<type>().is<arithmetic_type>());
|
||||
|
||||
const arithmetic_type at = type_db::get<type>().as<arithmetic_type>();
|
||||
CHECK(at.id() == type_id{typename_arg<base_type::tag<type>>});
|
||||
|
||||
CHECK_FALSE(at.raw_type());
|
||||
CHECK(at.size() == sizeof(type));
|
||||
@@ -43,7 +42,6 @@ TEST_CASE("features/types/arithmetic") {
|
||||
REQUIRE(type_db::get<type>().is<arithmetic_type>());
|
||||
|
||||
const arithmetic_type at = type_db::get<type>().as<arithmetic_type>();
|
||||
CHECK(at.id() == type_id{typename_arg<base_type::tag<type>>});
|
||||
|
||||
CHECK(at.raw_type().id() == type_db::get<float>().id());
|
||||
CHECK(at.size() == sizeof(type));
|
||||
@@ -67,7 +65,6 @@ TEST_CASE("features/types/arithmetic") {
|
||||
REQUIRE(type_db::get<type>().is<arithmetic_type>());
|
||||
|
||||
const arithmetic_type at = type_db::get<type>().as<arithmetic_type>();
|
||||
CHECK(at.id() == type_id{typename_arg<base_type::tag<type>>});
|
||||
|
||||
CHECK(at.raw_type().id() == type_db::get<unsigned>().id());
|
||||
CHECK(at.size() == sizeof(type));
|
||||
|
||||
@@ -20,7 +20,6 @@ TEST_CASE("features/types/array") {
|
||||
REQUIRE(type_db::get<type>().is<array_type>());
|
||||
|
||||
const array_type at = type_db::get<type>().as<array_type>();
|
||||
CHECK(at.id() == type_id{typename_arg<base_type::tag<type>>});
|
||||
|
||||
CHECK(at.data_type().id() == type_db::get<int>().id());
|
||||
CHECK(at.extent() == 0);
|
||||
@@ -38,7 +37,6 @@ TEST_CASE("features/types/array") {
|
||||
REQUIRE(type_db::get<type>().is<array_type>());
|
||||
|
||||
const array_type at = type_db::get<type>().as<array_type>();
|
||||
CHECK(at.id() == type_id{typename_arg<base_type::tag<type>>});
|
||||
|
||||
CHECK(at.data_type().id() == type_db::get<const unsigned>().id());
|
||||
CHECK(at.extent() == 42);
|
||||
|
||||
@@ -38,7 +38,6 @@ TEST_CASE("features/types/class") {
|
||||
REQUIRE(type_db::get<type>().is<class_type>());
|
||||
|
||||
const class_type ct = type_db::get<type>().as<class_type>();
|
||||
CHECK(ct.id() == type_id{typename_arg<base_type::tag<type>>});
|
||||
|
||||
CHECK_FALSE(ct.raw_type());
|
||||
CHECK(ct.size() == sizeof(type));
|
||||
@@ -61,7 +60,6 @@ TEST_CASE("features/types/class") {
|
||||
REQUIRE(type_db::get<type>().is<class_type>());
|
||||
|
||||
const class_type ct = type_db::get<type>().as<class_type>();
|
||||
CHECK(ct.id() == type_id{typename_arg<base_type::tag<type>>});
|
||||
|
||||
CHECK_FALSE(ct.raw_type());
|
||||
CHECK(ct.size() == sizeof(type));
|
||||
@@ -84,7 +82,6 @@ TEST_CASE("features/types/class") {
|
||||
REQUIRE(type_db::get<type>().is<class_type>());
|
||||
|
||||
const class_type ct = type_db::get<type>().as<class_type>();
|
||||
CHECK(ct.id() == type_id{typename_arg<base_type::tag<type>>});
|
||||
|
||||
CHECK_FALSE(ct.raw_type());
|
||||
CHECK(ct.size() == sizeof(type));
|
||||
@@ -107,7 +104,6 @@ TEST_CASE("features/types/class") {
|
||||
REQUIRE(type_db::get<type>().is<class_type>());
|
||||
|
||||
const class_type ct = type_db::get<type>().as<class_type>();
|
||||
CHECK(ct.id() == type_id{typename_arg<base_type::tag<type>>});
|
||||
|
||||
CHECK_FALSE(ct.raw_type());
|
||||
CHECK(ct.size() == sizeof(type));
|
||||
@@ -129,7 +125,6 @@ TEST_CASE("features/types/class") {
|
||||
REQUIRE(type_db::get<type>().is<class_type>());
|
||||
|
||||
const class_type ct = type_db::get<type>().as<class_type>();
|
||||
CHECK(ct.id() == type_id{typename_arg<base_type::tag<type>>});
|
||||
|
||||
REQUIRE(ct.raw_type());
|
||||
CHECK(ct.raw_type().id() == type_db::get<ivec2>().id());
|
||||
|
||||
@@ -29,7 +29,6 @@ TEST_CASE("features/types/enum") {
|
||||
REQUIRE(type_db::get<type>().is<enum_type>());
|
||||
|
||||
const enum_type et = type_db::get<type>().as<enum_type>();
|
||||
CHECK(et.id() == type_id{typename_arg<base_type::tag<type>>});
|
||||
|
||||
CHECK_FALSE(et.raw_type());
|
||||
CHECK(et.underlying_type().id() == type_db::get<unsigned>().id());
|
||||
@@ -45,7 +44,6 @@ TEST_CASE("features/types/enum") {
|
||||
REQUIRE(type_db::get<type>().is<enum_type>());
|
||||
|
||||
const enum_type et = type_db::get<type>().as<enum_type>();
|
||||
CHECK(et.id() == type_id{typename_arg<base_type::tag<type>>});
|
||||
|
||||
REQUIRE(et.raw_type());
|
||||
CHECK(et.raw_type().id() == type_db::get<ecolor>().id());
|
||||
|
||||
@@ -28,7 +28,6 @@ TEST_CASE("features/types/pointer") {
|
||||
REQUIRE(type_db::get<type>().is<pointer_type>());
|
||||
|
||||
const pointer_type pt = type_db::get<type>().as<pointer_type>();
|
||||
CHECK(pt.id() == type_id{typename_arg<base_type::tag<type>>});
|
||||
|
||||
CHECK(pt.data_type().id() == type_db::get<ivec2>().id());
|
||||
|
||||
@@ -43,7 +42,6 @@ TEST_CASE("features/types/pointer") {
|
||||
REQUIRE(type_db::get<type>().is<pointer_type>());
|
||||
|
||||
const pointer_type pt = type_db::get<type>().as<pointer_type>();
|
||||
CHECK(pt.id() == type_id{typename_arg<base_type::tag<type>>});
|
||||
|
||||
CHECK(pt.data_type().id() == type_db::get<const ivec2>().id());
|
||||
|
||||
@@ -58,7 +56,6 @@ TEST_CASE("features/types/pointer") {
|
||||
REQUIRE(type_db::get<type>().is<pointer_type>());
|
||||
|
||||
const pointer_type pt = type_db::get<type>().as<pointer_type>();
|
||||
CHECK(pt.id() == type_id{typename_arg<base_type::tag<type>>});
|
||||
|
||||
CHECK(pt.data_type().id() == type_db::get<ivec2>().id());
|
||||
|
||||
@@ -73,7 +70,6 @@ TEST_CASE("features/types/pointer") {
|
||||
REQUIRE(type_db::get<type>().is<pointer_type>());
|
||||
|
||||
const pointer_type pt = type_db::get<type>().as<pointer_type>();
|
||||
CHECK(pt.id() == type_id{typename_arg<base_type::tag<type>>});
|
||||
|
||||
CHECK(pt.data_type().id() == type_db::get<const ivec2>().id());
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ TEST_CASE("features/types/reference") {
|
||||
REQUIRE(type_db::get<ivec2&>().is<reference_type>());
|
||||
|
||||
const reference_type rt = type_db::get<ivec2&>().as<reference_type>();
|
||||
CHECK(rt.id() == type_id{typename_arg<base_type::tag<ivec2&>>});
|
||||
|
||||
CHECK(rt.data_type().id() == type_db::get<ivec2>().id());
|
||||
|
||||
@@ -41,7 +40,6 @@ TEST_CASE("features/types/reference") {
|
||||
REQUIRE(type_db::get<const ivec2&&>().is<reference_type>());
|
||||
|
||||
const reference_type rt = type_db::get<const ivec2&&>().as<reference_type>();
|
||||
CHECK(rt.id() == type_id{typename_arg<base_type::tag<const ivec2&&>>});
|
||||
|
||||
CHECK(rt.data_type().id() == type_db::get<const ivec2>().id());
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ TEST_CASE("features/types/void") {
|
||||
REQUIRE(type_db::get<type>().is<void_type>());
|
||||
|
||||
const void_type vt = type_db::get<type>().as<void_type>();
|
||||
CHECK(vt.id() == type_id{typename_arg<base_type::tag<type>>});
|
||||
|
||||
CHECK_FALSE(vt.raw_type());
|
||||
|
||||
@@ -35,7 +34,6 @@ TEST_CASE("features/types/void") {
|
||||
REQUIRE(type_db::get<type>().is<void_type>());
|
||||
|
||||
const void_type vt = type_db::get<type>().as<void_type>();
|
||||
CHECK(vt.id() == type_id{typename_arg<base_type::tag<type>>});
|
||||
|
||||
REQUIRE(vt.raw_type());
|
||||
CHECK(vt.raw_type().id() == type_db::get<void>().id());
|
||||
|
||||
Reference in New Issue
Block a user