first version of shared types

This commit is contained in:
BlackMATov
2024-02-05 02:09:55 +07:00
parent e2f287420a
commit 9c3a8b5f6c
20 changed files with 1576 additions and 147 deletions

View File

@@ -0,0 +1,375 @@
/*******************************************************************************
* This file is part of the "https://github.com/blackmatov/meta.hpp"
* For conditions of distribution and use, see copyright notice in LICENSE.md
* Copyright (C) 2021-2024, by Matvey Cherevko (blackmatov@gmail.com)
******************************************************************************/
#pragma once
#include "../meta_base.hpp"
#include "type_traits/array_traits.hpp"
#include "type_traits/class_traits.hpp"
#include "type_traits/constructor_traits.hpp"
#include "type_traits/destructor_traits.hpp"
#include "type_traits/enum_traits.hpp"
#include "type_traits/function_traits.hpp"
#include "type_traits/member_traits.hpp"
#include "type_traits/method_traits.hpp"
#include "type_traits/number_traits.hpp"
#include "type_traits/pointer_traits.hpp"
#include "type_traits/reference_traits.hpp"
namespace meta_hpp::detail
{
template < typename T >
struct shared_type_name;
template < type_kind, typename... >
struct shared_type_hash;
}
namespace meta_hpp::detail
{
template < typename Type >
[[nodiscard]] constexpr std::size_t shared_hash() noexcept {
return shared_type_hash<type_to_kind_v<Type>, Type>{}();
}
template < enum_kind Enum >
[[nodiscard]] constexpr std::size_t shared_hash(Enum value) noexcept {
return static_cast<std::size_t>(value);
}
template < enum_kind Enum >
[[nodiscard]] constexpr std::size_t shared_hash(bitflags<Enum> value) noexcept {
return static_cast<std::size_t>(value.as_raw());
}
template < typename Integral >
requires(std::is_integral_v<Integral> && sizeof(Integral) <= sizeof(std::size_t))
[[nodiscard]] constexpr std::size_t shared_hash(Integral value) noexcept {
return static_cast<std::size_t>(value);
}
template < typename Value >
requires(sizeof(std::size_t) == sizeof(std::uint32_t))
[[nodiscard]] constexpr std::size_t shared_hash_append(std::size_t seed, Value value) noexcept {
// NOLINTNEXTLINE(*-magic-numbers)
return (seed ^= shared_hash(value) + 0x9e3779b9U + (seed << 6) + (seed >> 2));
}
template < typename Value >
requires(sizeof(std::size_t) == sizeof(std::uint64_t))
[[nodiscard]] constexpr std::size_t shared_hash_append(std::size_t seed, Value value) noexcept {
// NOLINTNEXTLINE(*-magic-numbers)
return (seed ^= shared_hash(value) + 0x9e3779b97f4a7c15LLU + (seed << 12) + (seed >> 4));
}
}
namespace meta_hpp::detail
{
template < typename T >
struct is_shared_type : std::false_type {};
template < typename T >
concept shared_type_kind = is_shared_type<std::remove_cv_t<T>>::value;
}
namespace meta_hpp::detail
{
template < type_kind, typename... >
struct shared_type_data_hash {
[[nodiscard]] std::size_t operator()(const void* type_data) const noexcept {
return hash_combiner{}(type_data);
}
};
template < type_kind Kind, shared_type_kind Type >
struct shared_type_data_hash<Kind, Type> {
[[nodiscard]] std::size_t operator()(const void*) const noexcept {
return shared_type_hash<Kind, Type>{}();
}
};
template < shared_type_kind Class, shared_type_kind... Args >
struct shared_type_data_hash<type_kind::constructor_, Class, Args...> {
[[nodiscard]] std::size_t operator()(const void*) const noexcept {
return shared_type_hash<type_kind::constructor_, Class, Args...>{}();
}
};
template < shared_type_kind Class >
struct shared_type_data_hash<type_kind::destructor_, Class> {
[[nodiscard]] std::size_t operator()(const void*) const noexcept {
return shared_type_hash<type_kind::destructor_, Class>{}();
}
};
}
namespace meta_hpp::detail
{
template < typename T >
requires requires {
{ shared_type_name<T>{}() };
}
struct is_shared_type<T> : std::true_type {};
template < array_kind Array >
requires shared_type_kind<typename array_traits<Array>::data_type>
struct is_shared_type<Array> : std::true_type {};
template < function_kind Function >
requires shared_type_kind<typename function_traits<Function>::return_type>
&& type_list_and_v<is_shared_type, typename function_traits<Function>::argument_types>
struct is_shared_type<Function> : std::true_type {};
template < member_pointer_kind Member >
requires shared_type_kind<typename member_traits<Member>::class_type>
&& shared_type_kind<typename member_traits<Member>::value_type>
struct is_shared_type<Member> : std::true_type {};
template < method_pointer_kind Method >
requires shared_type_kind<typename method_traits<Method>::class_type>
&& shared_type_kind<typename method_traits<Method>::return_type>
&& type_list_and_v<is_shared_type, typename method_traits<Method>::argument_types>
struct is_shared_type<Method> : std::true_type {};
template < pointer_kind Pointer >
requires shared_type_kind<typename pointer_traits<Pointer>::data_type>
struct is_shared_type<Pointer> : std::true_type {};
template < reference_kind Reference >
requires shared_type_kind<typename reference_traits<Reference>::data_type>
struct is_shared_type<Reference> : std::true_type {};
}
namespace meta_hpp::detail
{
template < shared_type_kind Array >
struct shared_type_hash<type_kind::array_, Array> {
[[nodiscard]] constexpr std::size_t operator()() const noexcept {
std::size_t hash = shared_hash(type_kind::array_);
using traits = array_traits<Array>;
hash = shared_hash_append(hash, traits::make_flags());
hash = shared_hash_append(hash, shared_hash<typename traits::data_type>());
hash = shared_hash_append(hash, traits::extent);
return hash;
}
};
template < shared_type_kind Class >
struct shared_type_hash<type_kind::class_, Class> {
[[nodiscard]] constexpr std::size_t operator()() const noexcept {
std::size_t hash = shared_hash(type_kind::class_);
using traits = class_traits<Class>;
hash = shared_hash_append(hash, traits::make_flags());
hash = shared_hash_append(hash, shared_type_name<Class>{}());
return hash;
}
};
template < shared_type_kind Class, shared_type_kind... Args >
struct shared_type_hash<type_kind::constructor_, Class, Args...> {
[[nodiscard]] constexpr std::size_t operator()() const noexcept {
std::size_t hash = shared_hash(type_kind::constructor_);
using traits = constructor_traits<Class, Args...>;
hash = shared_hash_append(hash, traits::make_flags());
hash = shared_hash_append(hash, shared_hash<typename traits::class_type>());
traits::argument_types::for_each([&hash]<typename Arg>() { //
hash = shared_hash_append(hash, shared_hash<Arg>());
});
return hash;
}
};
template < shared_type_kind Class >
struct shared_type_hash<type_kind::destructor_, Class> {
[[nodiscard]] constexpr std::size_t operator()() const noexcept {
std::size_t hash = shared_hash(type_kind::destructor_);
using traits = destructor_traits<Class>;
hash = shared_hash_append(hash, traits::make_flags());
hash = shared_hash_append(hash, shared_hash<typename traits::class_type>());
return hash;
}
};
template < shared_type_kind Enum >
struct shared_type_hash<type_kind::enum_, Enum> {
[[nodiscard]] constexpr std::size_t operator()() const noexcept {
std::size_t hash = shared_hash(type_kind::enum_);
using traits = enum_traits<Enum>;
hash = shared_hash_append(hash, traits::make_flags());
hash = shared_hash_append(hash, shared_type_name<Enum>{}());
return hash;
}
};
template < shared_type_kind Function >
struct shared_type_hash<type_kind::function_, Function> {
[[nodiscard]] constexpr std::size_t operator()() const noexcept {
std::size_t hash = shared_hash(type_kind::function_);
using traits = function_traits<Function>;
hash = shared_hash_append(hash, traits::make_flags());
hash = shared_hash_append(hash, shared_hash<typename traits::return_type>());
traits::argument_types::for_each([&hash]<typename Arg>() { //
hash = shared_hash_append(hash, shared_hash<Arg>());
});
return hash;
}
};
template < shared_type_kind Member >
struct shared_type_hash<type_kind::member_, Member> {
[[nodiscard]] constexpr std::size_t operator()() const noexcept {
std::size_t hash = shared_hash(type_kind::member_);
using traits = member_traits<Member>;
hash = shared_hash_append(hash, traits::make_flags());
hash = shared_hash_append(hash, shared_hash<typename traits::class_type>());
hash = shared_hash_append(hash, shared_hash<typename traits::value_type>());
return hash;
}
};
template < shared_type_kind Method >
struct shared_type_hash<type_kind::method_, Method> {
[[nodiscard]] constexpr std::size_t operator()() const noexcept {
std::size_t hash = shared_hash(type_kind::method_);
using traits = method_traits<Method>;
hash = shared_hash_append(hash, traits::make_flags());
hash = shared_hash_append(hash, shared_hash<typename traits::class_type>());
hash = shared_hash_append(hash, shared_hash<typename traits::return_type>());
traits::argument_types::for_each([&hash]<typename Arg>() { //
hash = shared_hash_append(hash, shared_hash<Arg>());
});
return hash;
}
};
template < shared_type_kind Nullptr >
struct shared_type_hash<type_kind::nullptr_, Nullptr> {
[[nodiscard]] constexpr std::size_t operator()() const noexcept {
std::size_t hash = shared_hash(type_kind::nullptr_);
hash = shared_hash_append(hash, shared_type_name<Nullptr>{}());
return hash;
}
};
template < shared_type_kind Number >
struct shared_type_hash<type_kind::number_, Number> {
[[nodiscard]] constexpr std::size_t operator()() const noexcept {
std::size_t hash = shared_hash(type_kind::number_);
using traits = number_traits<Number>;
hash = shared_hash_append(hash, traits::make_flags());
hash = shared_hash_append(hash, shared_type_name<Number>{}());
return hash;
}
};
template < shared_type_kind Pointer >
struct shared_type_hash<type_kind::pointer_, Pointer> {
[[nodiscard]] constexpr std::size_t operator()() const noexcept {
std::size_t hash = shared_hash(type_kind::pointer_);
using traits = pointer_traits<Pointer>;
hash = shared_hash_append(hash, traits::make_flags());
hash = shared_hash_append(hash, shared_hash<typename traits::data_type>());
return hash;
}
};
template < shared_type_kind Reference >
struct shared_type_hash<type_kind::reference_, Reference> {
[[nodiscard]] constexpr std::size_t operator()() const noexcept {
std::size_t hash = shared_hash(type_kind::reference_);
using traits = reference_traits<Reference>;
hash = shared_hash_append(hash, traits::make_flags());
hash = shared_hash_append(hash, shared_hash<typename traits::data_type>());
return hash;
}
};
template < shared_type_kind Void >
struct shared_type_hash<type_kind::void_, Void> {
[[nodiscard]] constexpr std::size_t operator()() const noexcept {
std::size_t hash = shared_hash(type_kind::void_);
hash = shared_hash_append(hash, shared_type_name<Void>{}());
return hash;
}
};
}
#define META_HPP_DEFINE_SHARED_TYPE(Type, Name) \
namespace meta_hpp::detail \
{ \
template <> \
struct shared_type_name<Type> { \
[[nodiscard]] constexpr std::size_t operator()() const noexcept { \
return hashed_string{Name}.get_hash(); \
} \
}; \
}
META_HPP_DEFINE_SHARED_TYPE(void, "void")
META_HPP_DEFINE_SHARED_TYPE(bool, "bool")
META_HPP_DEFINE_SHARED_TYPE(wchar_t, "wchar_t")
META_HPP_DEFINE_SHARED_TYPE(decltype(nullptr), "nullptr_t")
META_HPP_DEFINE_SHARED_TYPE(char8_t, "char8_t")
META_HPP_DEFINE_SHARED_TYPE(char16_t, "char16_t")
META_HPP_DEFINE_SHARED_TYPE(char32_t, "char32_t")
META_HPP_DEFINE_SHARED_TYPE(float, "float")
META_HPP_DEFINE_SHARED_TYPE(double, "double")
META_HPP_DEFINE_SHARED_TYPE(long double, "long double")
META_HPP_DEFINE_SHARED_TYPE(signed char, "schar")
META_HPP_DEFINE_SHARED_TYPE(unsigned char, "uchar")
META_HPP_DEFINE_SHARED_TYPE(signed short, "sshort")
META_HPP_DEFINE_SHARED_TYPE(unsigned short, "ushort")
META_HPP_DEFINE_SHARED_TYPE(signed int, "sint")
META_HPP_DEFINE_SHARED_TYPE(unsigned int, "uint")
META_HPP_DEFINE_SHARED_TYPE(signed long, "slong")
META_HPP_DEFINE_SHARED_TYPE(unsigned long, "ulong")
META_HPP_DEFINE_SHARED_TYPE(signed long long, "sllong")
META_HPP_DEFINE_SHARED_TYPE(unsigned long long, "ullong")

View File

@@ -52,31 +52,28 @@ namespace meta_hpp
class type_id final {
public:
type_id() = default;
~type_id() = default;
[[nodiscard]] bool is_valid() const noexcept {
return data_ != nullptr;
}
type_id(type_id&&) = default;
type_id(const type_id&) = default;
[[nodiscard]] explicit operator bool() const noexcept {
return is_valid();
}
type_id& operator=(type_id&&) = default;
type_id& operator=(const type_id&) = default;
void swap(type_id& other) noexcept {
std::swap(data_, other.data_);
}
[[nodiscard]] bool is_valid() const noexcept;
[[nodiscard]] explicit operator bool() const noexcept;
[[nodiscard]] std::size_t get_hash() const noexcept {
return data_ != nullptr ? detail::hash_combiner{}(data_) : 0;
}
void swap(type_id& other) noexcept;
[[nodiscard]] std::size_t get_hash() const noexcept;
[[nodiscard]] std::strong_ordering operator<=>(const type_id& other) const = default;
[[nodiscard]] bool operator==(const type_id& other) const noexcept;
[[nodiscard]] std::strong_ordering operator<=>(const type_id& other) const noexcept;
private:
template < type_family T >
friend class type_base;
explicit type_id(const detail::type_data_base* data)
: data_{data} {}
explicit type_id(const detail::type_data_base* data);
private:
const detail::type_data_base* data_{};
@@ -105,34 +102,20 @@ namespace meta_hpp
type_base() = default;
explicit type_base(data_ptr data)
: data_{data} {}
explicit type_base(data_ptr data);
type_base(type_base&&) noexcept = default;
type_base(type_base&&) = default;
type_base(const type_base&) = default;
type_base& operator=(type_base&&) noexcept = default;
type_base& operator=(type_base&&) = default;
type_base& operator=(const type_base&) = default;
[[nodiscard]] bool is_valid() const noexcept {
return data_ != nullptr;
}
[[nodiscard]] bool is_valid() const noexcept;
[[nodiscard]] explicit operator bool() const noexcept;
[[nodiscard]] explicit operator bool() const noexcept {
return is_valid();
}
[[nodiscard]] id_type get_id() const noexcept {
return id_type{data_};
}
[[nodiscard]] type_kind get_kind() const noexcept {
return data_->kind;
}
[[nodiscard]] const metadata_map& get_metadata() const noexcept {
return data_->metadata;
}
[[nodiscard]] id_type get_id() const noexcept;
[[nodiscard]] type_kind get_kind() const noexcept;
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
protected:
~type_base() = default;
@@ -461,12 +444,14 @@ namespace meta_hpp::detail
struct type_data_base {
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
const type_kind kind;
const std::size_t shared;
// NOLINTEND(*-avoid-const-or-ref-data-members)
metadata_map metadata;
explicit type_data_base(type_kind nkind)
: kind{nkind} {}
explicit type_data_base(type_kind nkind, std::size_t nshared)
: kind{nkind}
, shared{nshared} {}
type_data_base(type_data_base&&) = delete;
type_data_base(const type_data_base&) = delete;
@@ -631,3 +616,82 @@ namespace meta_hpp::detail
explicit void_type_data(type_list<Void>);
};
}
namespace meta_hpp
{
inline type_id::type_id(const detail::type_data_base* data)
: data_{data} {}
inline bool type_id::is_valid() const noexcept {
return data_ != nullptr;
}
inline type_id::operator bool() const noexcept {
return is_valid();
}
inline void type_id::swap(type_id& other) noexcept {
std::swap(data_, other.data_);
}
inline std::size_t type_id::get_hash() const noexcept {
return data_ != nullptr ? data_->shared : 0;
}
inline bool type_id::operator==(const type_id& other) const noexcept {
if ( data_ == other.data_ ) {
return true;
}
if ( is_valid() != other.is_valid() ) {
return false;
}
return data_->shared == other.data_->shared;
}
inline std::strong_ordering type_id::operator<=>(const type_id& other) const noexcept {
if ( data_ == other.data_ ) {
return std::strong_ordering::equal;
}
// NOLINTNEXTLINE(*-bool-conversion)
if ( const std::strong_ordering cmp{is_valid() <=> other.is_valid()}; cmp != std::strong_ordering::equal ) {
return cmp;
}
return data_->shared <=> other.data_->shared;
}
}
namespace meta_hpp
{
template < type_family Type >
type_base<Type>::type_base(data_ptr data)
: data_{data} {}
template < type_family Type >
bool type_base<Type>::is_valid() const noexcept {
return data_ != nullptr;
}
template < type_family Type >
type_base<Type>::operator bool() const noexcept {
return is_valid();
}
template < type_family Type >
type_base<Type>::id_type type_base<Type>::get_id() const noexcept {
return id_type{data_};
}
template < type_family Type >
type_kind type_base<Type>::get_kind() const noexcept {
return data_->kind;
}
template < type_family Type >
const metadata_map& type_base<Type>::get_metadata() const noexcept {
return data_->metadata;
}
}

View File

@@ -10,13 +10,14 @@
#include "../meta_registry.hpp"
#include "../meta_types.hpp"
#include "../meta_detail/type_sharing.hpp"
#include "../meta_detail/type_traits/array_traits.hpp"
namespace meta_hpp::detail
{
template < array_kind Array >
array_type_data::array_type_data(type_list<Array>)
: type_data_base{type_kind::array_}
: type_data_base{type_kind::array_, shared_type_data_hash<type_kind::array_, Array>{}(this)}
, flags{array_traits<Array>::make_flags()}
, extent{array_traits<Array>::extent}
, data_type{resolve_type<typename array_traits<Array>::data_type>()} {}

View File

@@ -16,6 +16,7 @@
#include "../meta_states/method.hpp"
#include "../meta_states/variable.hpp"
#include "../meta_detail/type_sharing.hpp"
#include "../meta_detail/type_traits/class_traits.hpp"
namespace meta_hpp::detail::class_type_data_impl
@@ -105,7 +106,7 @@ namespace meta_hpp::detail
{
template < class_kind Class >
class_type_data::class_type_data(type_list<Class>)
: type_data_base{type_kind::class_}
: type_data_base{type_kind::class_, shared_type_data_hash<type_kind::class_, Class>{}(this)}
, flags{class_traits<Class>::make_flags()}
, size{class_traits<Class>::size}
, align{class_traits<Class>::align}

View File

@@ -10,6 +10,7 @@
#include "../meta_registry.hpp"
#include "../meta_types.hpp"
#include "../meta_detail/type_sharing.hpp"
#include "../meta_detail/type_traits/constructor_traits.hpp"
namespace meta_hpp::detail::constructor_type_data_impl
@@ -37,7 +38,7 @@ namespace meta_hpp::detail
{
template < class_kind Class, typename... Args >
constructor_type_data::constructor_type_data(type_list<Class>, type_list<Args...>)
: type_data_base{type_kind::constructor_}
: type_data_base{type_kind::constructor_, shared_type_data_hash<type_kind::constructor_, Class, Args...>{}(this)}
, flags{constructor_traits<Class, Args...>::make_flags()}
, owner_type{resolve_type<typename constructor_traits<Class, Args...>::class_type>()}
, argument_types(constructor_type_data_impl::make_argument_types<Class, Args...>()) {}

View File

@@ -10,13 +10,14 @@
#include "../meta_registry.hpp"
#include "../meta_types.hpp"
#include "../meta_detail/type_sharing.hpp"
#include "../meta_detail/type_traits/destructor_traits.hpp"
namespace meta_hpp::detail
{
template < class_kind Class >
destructor_type_data::destructor_type_data(type_list<Class>)
: type_data_base{type_kind::destructor_}
: type_data_base{type_kind::destructor_, shared_type_data_hash<type_kind::destructor_, Class>{}(this)}
, flags{destructor_traits<Class>::make_flags()}
, owner_type{resolve_type<typename destructor_traits<Class>::class_type>()} {}
}

View File

@@ -12,6 +12,7 @@
#include "../meta_states/evalue.hpp"
#include "../meta_detail/type_sharing.hpp"
#include "../meta_detail/type_traits/enum_traits.hpp"
#include "../meta_detail/value_utilities/uarg.hpp"
@@ -19,7 +20,7 @@ namespace meta_hpp::detail
{
template < enum_kind Enum >
enum_type_data::enum_type_data(type_list<Enum>)
: type_data_base{type_kind::enum_}
: type_data_base{type_kind::enum_, shared_type_data_hash<type_kind::enum_, Enum>{}(this)}
, flags{enum_traits<Enum>::make_flags()}
, underlying_type{resolve_type<typename enum_traits<Enum>::underlying_type>()} {}
}

View File

@@ -10,6 +10,7 @@
#include "../meta_registry.hpp"
#include "../meta_types.hpp"
#include "../meta_detail/type_sharing.hpp"
#include "../meta_detail/type_traits/function_traits.hpp"
namespace meta_hpp::detail::function_type_data_impl
@@ -37,7 +38,7 @@ namespace meta_hpp::detail
{
template < function_kind Function >
function_type_data::function_type_data(type_list<Function>)
: type_data_base{type_kind::function_}
: type_data_base{type_kind::function_, shared_type_data_hash<type_kind::function_, Function>{}(this)}
, flags{function_traits<Function>::make_flags()}
, return_type{resolve_type<typename function_traits<Function>::return_type>()}
, argument_types(function_type_data_impl::make_argument_types<Function>()) {}

View File

@@ -10,13 +10,14 @@
#include "../meta_registry.hpp"
#include "../meta_types.hpp"
#include "../meta_detail/type_sharing.hpp"
#include "../meta_detail/type_traits/member_traits.hpp"
namespace meta_hpp::detail
{
template < member_pointer_kind Member >
member_type_data::member_type_data(type_list<Member>)
: type_data_base{type_kind::member_}
: type_data_base{type_kind::member_, shared_type_data_hash<type_kind::member_, Member>{}(this)}
, flags{member_traits<Member>::make_flags()}
, owner_type{resolve_type<typename member_traits<Member>::class_type>()}
, value_type{resolve_type<typename member_traits<Member>::value_type>()} {}

View File

@@ -10,6 +10,7 @@
#include "../meta_registry.hpp"
#include "../meta_types.hpp"
#include "../meta_detail/type_sharing.hpp"
#include "../meta_detail/type_traits/method_traits.hpp"
namespace meta_hpp::detail::method_type_data_impl
@@ -37,7 +38,7 @@ namespace meta_hpp::detail
{
template < method_pointer_kind Method >
method_type_data::method_type_data(type_list<Method>)
: type_data_base{type_kind::method_}
: type_data_base{type_kind::method_, shared_type_data_hash<type_kind::method_, Method>{}(this)}
, flags{method_traits<Method>::make_flags()}
, owner_type{resolve_type<typename method_traits<Method>::class_type>()}
, return_type{resolve_type<typename method_traits<Method>::return_type>()}

View File

@@ -10,9 +10,11 @@
#include "../meta_registry.hpp"
#include "../meta_types.hpp"
#include "../meta_detail/type_sharing.hpp"
namespace meta_hpp::detail
{
template < nullptr_kind Nullptr >
nullptr_type_data::nullptr_type_data(type_list<Nullptr>)
: type_data_base{type_kind::nullptr_} {}
: type_data_base{type_kind::nullptr_, shared_type_data_hash<type_kind::nullptr_, Nullptr>{}(this)} {}
}

View File

@@ -10,13 +10,14 @@
#include "../meta_registry.hpp"
#include "../meta_types.hpp"
#include "../meta_detail/type_sharing.hpp"
#include "../meta_detail/type_traits/number_traits.hpp"
namespace meta_hpp::detail
{
template < number_kind Number >
number_type_data::number_type_data(type_list<Number>)
: type_data_base{type_kind::number_}
: type_data_base{type_kind::number_, shared_type_data_hash<type_kind::number_, Number>{}(this)}
, flags{number_traits<Number>::make_flags()}
, size{number_traits<Number>::size}
, align{number_traits<Number>::align} {}

View File

@@ -10,13 +10,14 @@
#include "../meta_registry.hpp"
#include "../meta_types.hpp"
#include "../meta_detail/type_sharing.hpp"
#include "../meta_detail/type_traits/pointer_traits.hpp"
namespace meta_hpp::detail
{
template < pointer_kind Pointer >
pointer_type_data::pointer_type_data(type_list<Pointer>)
: type_data_base{type_kind::pointer_}
: type_data_base{type_kind::pointer_, shared_type_data_hash<type_kind::pointer_, Pointer>{}(this)}
, flags{pointer_traits<Pointer>::make_flags()}
, data_type{resolve_type<typename pointer_traits<Pointer>::data_type>()} {}
}

View File

@@ -10,13 +10,14 @@
#include "../meta_registry.hpp"
#include "../meta_types.hpp"
#include "../meta_detail/type_sharing.hpp"
#include "../meta_detail/type_traits/reference_traits.hpp"
namespace meta_hpp::detail
{
template < reference_kind Reference >
reference_type_data::reference_type_data(type_list<Reference>)
: type_data_base{type_kind::reference_}
: type_data_base{type_kind::reference_, shared_type_data_hash<type_kind::reference_, Reference>{}(this)}
, flags{reference_traits<Reference>::make_flags()}
, data_type{resolve_type<typename reference_traits<Reference>::data_type>()} {}
}

View File

@@ -10,9 +10,11 @@
#include "../meta_registry.hpp"
#include "../meta_types.hpp"
#include "../meta_detail/type_sharing.hpp"
namespace meta_hpp::detail
{
template < void_kind Void >
void_type_data::void_type_data(type_list<Void>)
: type_data_base{type_kind::void_} {}
: type_data_base{type_kind::void_, shared_type_data_hash<type_kind::void_, Void>{}(this)} {}
}