mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-16 22:17:02 +07:00
public meta_registry header instead detail using
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
---
|
---
|
||||||
Checks: '-*,
|
Checks: '-*,
|
||||||
|
|
||||||
|
bugprone-*,
|
||||||
|
|
||||||
clang-analyzer-*,
|
clang-analyzer-*,
|
||||||
|
|
||||||
concurrency-*,
|
concurrency-*,
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake")
|
|||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
include(EnableASan)
|
include(EnableASan)
|
||||||
|
include(EnableGCov)
|
||||||
include(EnableUBSan)
|
include(EnableUBSan)
|
||||||
|
|
||||||
add_subdirectory(manuals)
|
add_subdirectory(manuals)
|
||||||
|
|||||||
@@ -34,6 +34,8 @@
|
|||||||
#include "meta_indices/scope_index.hpp"
|
#include "meta_indices/scope_index.hpp"
|
||||||
#include "meta_indices/variable_index.hpp"
|
#include "meta_indices/variable_index.hpp"
|
||||||
|
|
||||||
|
#include "meta_registry.hpp"
|
||||||
|
|
||||||
#include "meta_states.hpp"
|
#include "meta_states.hpp"
|
||||||
#include "meta_states/argument.hpp"
|
#include "meta_states/argument.hpp"
|
||||||
#include "meta_states/constructor.hpp"
|
#include "meta_states/constructor.hpp"
|
||||||
@@ -64,11 +66,3 @@
|
|||||||
#include "meta_uvalue.hpp"
|
#include "meta_uvalue.hpp"
|
||||||
#include "meta_uvalue/invoke.hpp"
|
#include "meta_uvalue/invoke.hpp"
|
||||||
#include "meta_uvalue/uvalue.hpp"
|
#include "meta_uvalue/uvalue.hpp"
|
||||||
|
|
||||||
namespace meta_hpp
|
|
||||||
{
|
|
||||||
using detail::resolve_type;
|
|
||||||
using detail::resolve_polymorphic_type;
|
|
||||||
|
|
||||||
using detail::resolve_scope;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -8,14 +8,13 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_binds.hpp"
|
#include "../meta_binds.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::array_kind Array >
|
template < detail::array_kind Array >
|
||||||
array_bind<Array>::array_bind(metadata_map metadata)
|
array_bind<Array>::array_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<Array>())} {
|
: data_{detail::type_access(resolve_type<Array>())} {
|
||||||
data_->metadata.swap(metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,13 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_binds.hpp"
|
#include "../meta_binds.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::class_kind Class >
|
template < detail::class_kind Class >
|
||||||
class_bind<Class>::class_bind(metadata_map metadata)
|
class_bind<Class>::class_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<Class>())} {
|
: data_{detail::type_access(resolve_type<Class>())} {
|
||||||
data_->metadata.swap(metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
@@ -34,7 +33,7 @@ namespace meta_hpp
|
|||||||
class_bind<Class>& class_bind<Class>::base_()
|
class_bind<Class>& class_bind<Class>::base_()
|
||||||
requires detail::class_bind_base_kind<Class, Base>
|
requires detail::class_bind_base_kind<Class, Base>
|
||||||
{
|
{
|
||||||
const class_type base_type = detail::resolve_type<Base>();
|
const class_type base_type = resolve_type<Base>();
|
||||||
if ( data_->bases.contains(base_type) ) {
|
if ( data_->bases.contains(base_type) ) {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@@ -280,7 +279,7 @@ namespace meta_hpp
|
|||||||
template < detail::class_kind Class >
|
template < detail::class_kind Class >
|
||||||
template < typename Type >
|
template < typename Type >
|
||||||
class_bind<Class>& class_bind<Class>::typedef_(std::string name) {
|
class_bind<Class>& class_bind<Class>::typedef_(std::string name) {
|
||||||
data_->typedefs.insert_or_assign(std::move(name), detail::resolve_type<Type>());
|
data_->typedefs.insert_or_assign(std::move(name), resolve_type<Type>());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,14 +8,13 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_binds.hpp"
|
#include "../meta_binds.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::enum_kind Enum >
|
template < detail::enum_kind Enum >
|
||||||
enum_bind<Enum>::enum_bind(metadata_map metadata)
|
enum_bind<Enum>::enum_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<Enum>())} {
|
: data_{detail::type_access(resolve_type<Enum>())} {
|
||||||
data_->metadata.swap(metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,13 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_binds.hpp"
|
#include "../meta_binds.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::function_kind Function >
|
template < detail::function_kind Function >
|
||||||
function_bind<Function>::function_bind(metadata_map metadata)
|
function_bind<Function>::function_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<Function>())} {
|
: data_{detail::type_access(resolve_type<Function>())} {
|
||||||
data_->metadata.swap(metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,13 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_binds.hpp"
|
#include "../meta_binds.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::member_kind Member >
|
template < detail::member_kind Member >
|
||||||
member_bind<Member>::member_bind(metadata_map metadata)
|
member_bind<Member>::member_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<Member>())} {
|
: data_{detail::type_access(resolve_type<Member>())} {
|
||||||
data_->metadata.swap(metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,13 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_binds.hpp"
|
#include "../meta_binds.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::method_kind Method >
|
template < detail::method_kind Method >
|
||||||
method_bind<Method>::method_bind(metadata_map metadata)
|
method_bind<Method>::method_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<Method>())} {
|
: data_{detail::type_access(resolve_type<Method>())} {
|
||||||
data_->metadata.swap(metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,13 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_binds.hpp"
|
#include "../meta_binds.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::nullptr_kind Nullptr >
|
template < detail::nullptr_kind Nullptr >
|
||||||
nullptr_bind<Nullptr>::nullptr_bind(metadata_map metadata)
|
nullptr_bind<Nullptr>::nullptr_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<Nullptr>())} {
|
: data_{detail::type_access(resolve_type<Nullptr>())} {
|
||||||
data_->metadata.swap(metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,13 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_binds.hpp"
|
#include "../meta_binds.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::number_kind Number >
|
template < detail::number_kind Number >
|
||||||
number_bind<Number>::number_bind(metadata_map metadata)
|
number_bind<Number>::number_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<Number>())} {
|
: data_{detail::type_access(resolve_type<Number>())} {
|
||||||
data_->metadata.swap(metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,13 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_binds.hpp"
|
#include "../meta_binds.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::pointer_kind Pointer >
|
template < detail::pointer_kind Pointer >
|
||||||
pointer_bind<Pointer>::pointer_bind(metadata_map metadata)
|
pointer_bind<Pointer>::pointer_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<Pointer>())} {
|
: data_{detail::type_access(resolve_type<Pointer>())} {
|
||||||
data_->metadata.swap(metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,13 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_binds.hpp"
|
#include "../meta_binds.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::reference_kind Reference >
|
template < detail::reference_kind Reference >
|
||||||
reference_bind<Reference>::reference_bind(metadata_map metadata)
|
reference_bind<Reference>::reference_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<Reference>())} {
|
: data_{detail::type_access(resolve_type<Reference>())} {
|
||||||
data_->metadata.swap(metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,9 +8,7 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_binds.hpp"
|
#include "../meta_binds.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_detail/state_registry.hpp"
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
@@ -20,7 +18,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
// NOLINTNEXTLINE(readability-named-parameter)
|
// NOLINTNEXTLINE(readability-named-parameter)
|
||||||
inline scope_bind::scope_bind(std::string_view name, metadata_map metadata, static_tag)
|
inline scope_bind::scope_bind(std::string_view name, metadata_map metadata, static_tag)
|
||||||
: state_{detail::state_access(detail::resolve_scope(name))} {
|
: state_{detail::state_access(resolve_scope(name))} {
|
||||||
state_->metadata.swap(metadata);
|
state_->metadata.swap(metadata);
|
||||||
state_->metadata.merge(metadata);
|
state_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
@@ -99,7 +97,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
template < typename Type >
|
template < typename Type >
|
||||||
scope_bind& scope_bind::typedef_(std::string name) {
|
scope_bind& scope_bind::typedef_(std::string name) {
|
||||||
state_->typedefs.insert_or_assign(std::move(name), detail::resolve_type<Type>());
|
state_->typedefs.insert_or_assign(std::move(name), resolve_type<Type>());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,14 +8,13 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_binds.hpp"
|
#include "../meta_binds.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::void_kind Void >
|
template < detail::void_kind Void >
|
||||||
void_bind<Void>::void_bind(metadata_map metadata)
|
void_bind<Void>::void_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<void>())} {
|
: data_{detail::type_access(resolve_type<void>())} {
|
||||||
data_->metadata.swap(metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,11 +13,19 @@ namespace meta_hpp::detail
|
|||||||
{
|
{
|
||||||
class state_registry final {
|
class state_registry final {
|
||||||
public:
|
public:
|
||||||
|
class locker final : noncopyable {
|
||||||
|
public:
|
||||||
|
explicit locker()
|
||||||
|
: lock_{instance().mutex_} {}
|
||||||
|
private:
|
||||||
|
std::lock_guard<std::recursive_mutex> lock_;
|
||||||
|
};
|
||||||
|
|
||||||
[[nodiscard]] static state_registry& instance() {
|
[[nodiscard]] static state_registry& instance() {
|
||||||
static state_registry instance;
|
static state_registry instance;
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
public:
|
||||||
[[nodiscard]] scope get_scope_by_name(std::string_view name) const noexcept {
|
[[nodiscard]] scope get_scope_by_name(std::string_view name) const noexcept {
|
||||||
const locker lock;
|
const locker lock;
|
||||||
|
|
||||||
@@ -38,14 +46,6 @@ namespace meta_hpp::detail
|
|||||||
auto state = scope_state::make(std::string{name}, metadata_map{});
|
auto state = scope_state::make(std::string{name}, metadata_map{});
|
||||||
return scopes_.insert_or_assign(std::string{name}, std::move(state)).first->second;
|
return scopes_.insert_or_assign(std::string{name}, std::move(state)).first->second;
|
||||||
}
|
}
|
||||||
public:
|
|
||||||
class locker : noncopyable {
|
|
||||||
public:
|
|
||||||
explicit locker()
|
|
||||||
: lock_{instance().mutex_} {}
|
|
||||||
private:
|
|
||||||
std::lock_guard<std::recursive_mutex> lock_;
|
|
||||||
};
|
|
||||||
private:
|
private:
|
||||||
state_registry() = default;
|
state_registry() = default;
|
||||||
private:
|
private:
|
||||||
@@ -53,11 +53,3 @@ namespace meta_hpp::detail
|
|||||||
std::map<std::string, scope, std::less<>> scopes_;
|
std::map<std::string, scope, std::less<>> scopes_;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace meta_hpp::detail
|
|
||||||
{
|
|
||||||
[[nodiscard]] inline scope resolve_scope(std::string_view name) {
|
|
||||||
state_registry& registry = state_registry::instance();
|
|
||||||
return registry.resolve_scope(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -13,11 +13,19 @@ namespace meta_hpp::detail
|
|||||||
{
|
{
|
||||||
class type_registry final {
|
class type_registry final {
|
||||||
public:
|
public:
|
||||||
|
class locker final : noncopyable {
|
||||||
|
public:
|
||||||
|
explicit locker()
|
||||||
|
: lock_{instance().mutex_} {}
|
||||||
|
private:
|
||||||
|
std::lock_guard<std::recursive_mutex> lock_;
|
||||||
|
};
|
||||||
|
|
||||||
[[nodiscard]] static type_registry& instance() {
|
[[nodiscard]] static type_registry& instance() {
|
||||||
static type_registry instance;
|
static type_registry instance;
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
public:
|
||||||
[[nodiscard]] any_type get_type_by_id(type_id id) const noexcept {
|
[[nodiscard]] any_type get_type_by_id(type_id id) const noexcept {
|
||||||
const locker lock;
|
const locker lock;
|
||||||
|
|
||||||
@@ -37,11 +45,7 @@ namespace meta_hpp::detail
|
|||||||
|
|
||||||
return any_type{};
|
return any_type{};
|
||||||
}
|
}
|
||||||
|
public:
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
template < array_kind Array >
|
template < array_kind Array >
|
||||||
[[nodiscard]] array_type resolve_type() { return resolve_array_type<Array>(); }
|
[[nodiscard]] array_type resolve_type() { return resolve_array_type<Array>(); }
|
||||||
|
|
||||||
@@ -74,11 +78,7 @@ namespace meta_hpp::detail
|
|||||||
|
|
||||||
template < void_kind Void >
|
template < void_kind Void >
|
||||||
[[nodiscard]] void_type resolve_type() { return resolve_void_type<Void>(); }
|
[[nodiscard]] void_type resolve_type() { return resolve_void_type<Void>(); }
|
||||||
|
public:
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
template < array_kind Array >
|
template < array_kind Array >
|
||||||
[[nodiscard]] array_type resolve_array_type() { return array_type{resolve_array_type_data<Array>()}; }
|
[[nodiscard]] array_type resolve_array_type() { return array_type{resolve_array_type_data<Array>()}; }
|
||||||
|
|
||||||
@@ -117,11 +117,7 @@ namespace meta_hpp::detail
|
|||||||
|
|
||||||
template < void_kind Void >
|
template < void_kind Void >
|
||||||
[[nodiscard]] void_type resolve_void_type() { return void_type{resolve_void_type_data<Void>()}; }
|
[[nodiscard]] void_type resolve_void_type() { return void_type{resolve_void_type_data<Void>()}; }
|
||||||
|
private:
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
template < array_kind Array >
|
template < array_kind Array >
|
||||||
[[nodiscard]] array_type_data* resolve_array_type_data() {
|
[[nodiscard]] array_type_data* resolve_array_type_data() {
|
||||||
static array_type_data data{type_list<Array>{}};
|
static array_type_data data{type_list<Array>{}};
|
||||||
@@ -210,14 +206,6 @@ namespace meta_hpp::detail
|
|||||||
ensure_type<Void>(data);
|
ensure_type<Void>(data);
|
||||||
return &data;
|
return &data;
|
||||||
}
|
}
|
||||||
public:
|
|
||||||
class locker : noncopyable {
|
|
||||||
public:
|
|
||||||
explicit locker()
|
|
||||||
: lock_{instance().mutex_} {}
|
|
||||||
private:
|
|
||||||
std::lock_guard<std::recursive_mutex> lock_;
|
|
||||||
};
|
|
||||||
private:
|
private:
|
||||||
type_registry() = default;
|
type_registry() = default;
|
||||||
|
|
||||||
@@ -238,61 +226,3 @@ namespace meta_hpp::detail
|
|||||||
std::map<std::type_index, any_type, std::less<>> type_by_rtti_;
|
std::map<std::type_index, any_type, std::less<>> type_by_rtti_;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace meta_hpp::detail
|
|
||||||
{
|
|
||||||
template < typename T >
|
|
||||||
[[nodiscard]] auto resolve_type() {
|
|
||||||
type_registry& registry = type_registry::instance();
|
|
||||||
return registry.resolve_type<std::remove_cv_t<T>>();
|
|
||||||
}
|
|
||||||
|
|
||||||
template < typename... Ts >
|
|
||||||
[[nodiscard]] std::vector<any_type> resolve_types() {
|
|
||||||
return { resolve_type<Ts>()... };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace meta_hpp::detail
|
|
||||||
{
|
|
||||||
template < class_kind Class, typename... Args >
|
|
||||||
constructor_type resolve_constructor_type() {
|
|
||||||
type_registry& registry = type_registry::instance();
|
|
||||||
return registry.resolve_constructor_type<Class, Args...>();
|
|
||||||
}
|
|
||||||
|
|
||||||
template < class_kind Class >
|
|
||||||
destructor_type resolve_destructor_type() {
|
|
||||||
type_registry& registry = type_registry::instance();
|
|
||||||
return registry.resolve_destructor_type<Class>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace meta_hpp::detail
|
|
||||||
{
|
|
||||||
template < typename T >
|
|
||||||
// NOLINTNEXTLINE(readability-named-parameter)
|
|
||||||
[[nodiscard]] auto resolve_type(T&&) {
|
|
||||||
return resolve_type<std::remove_reference_t<T>>();
|
|
||||||
}
|
|
||||||
|
|
||||||
template < typename... Ts >
|
|
||||||
// NOLINTNEXTLINE(readability-named-parameter)
|
|
||||||
[[nodiscard]] std::vector<any_type> resolve_types(type_list<Ts...>) {
|
|
||||||
return { resolve_type<Ts>()... };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace meta_hpp::detail
|
|
||||||
{
|
|
||||||
template < typename T >
|
|
||||||
[[nodiscard]] any_type resolve_polymorphic_type(T&& v) noexcept {
|
|
||||||
#ifndef META_HPP_NO_RTTI
|
|
||||||
type_registry& registry = type_registry::instance();
|
|
||||||
return registry.get_type_by_rtti(typeid(v));
|
|
||||||
#else
|
|
||||||
(void)v;
|
|
||||||
return any_type{};
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -8,10 +8,9 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_indices.hpp"
|
#include "../meta_indices.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
inline argument_index::argument_index(any_type type, std::size_t position)
|
inline argument_index::argument_index(any_type type, std::size_t position)
|
||||||
@@ -20,7 +19,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
template < typename Argument >
|
template < typename Argument >
|
||||||
inline argument_index argument_index::make(std::size_t position) {
|
inline argument_index argument_index::make(std::size_t position) {
|
||||||
return argument_index{detail::resolve_type<Argument>(), position};
|
return argument_index{resolve_type<Argument>(), position};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::size_t argument_index::get_hash() const noexcept {
|
inline std::size_t argument_index::get_hash() const noexcept {
|
||||||
|
|||||||
@@ -8,10 +8,9 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_indices.hpp"
|
#include "../meta_indices.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
inline constructor_index::constructor_index(constructor_type type)
|
inline constructor_index::constructor_index(constructor_type type)
|
||||||
@@ -19,7 +18,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
template < detail::class_kind Class, typename... Args >
|
template < detail::class_kind Class, typename... Args >
|
||||||
constructor_index constructor_index::make() {
|
constructor_index constructor_index::make() {
|
||||||
return constructor_index{detail::resolve_constructor_type<Class, Args...>()};
|
return constructor_index{resolve_constructor_type<Class, Args...>()};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::size_t constructor_index::get_hash() const noexcept {
|
inline std::size_t constructor_index::get_hash() const noexcept {
|
||||||
|
|||||||
@@ -8,10 +8,9 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_indices.hpp"
|
#include "../meta_indices.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
inline destructor_index::destructor_index(destructor_type type)
|
inline destructor_index::destructor_index(destructor_type type)
|
||||||
@@ -19,7 +18,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
template < detail::class_kind Class >
|
template < detail::class_kind Class >
|
||||||
destructor_index destructor_index::make() {
|
destructor_index destructor_index::make() {
|
||||||
return destructor_index{detail::resolve_destructor_type<Class>()};
|
return destructor_index{resolve_destructor_type<Class>()};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::size_t destructor_index::get_hash() const noexcept {
|
inline std::size_t destructor_index::get_hash() const noexcept {
|
||||||
|
|||||||
@@ -8,10 +8,9 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_indices.hpp"
|
#include "../meta_indices.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
inline evalue_index::evalue_index(enum_type type, std::string name)
|
inline evalue_index::evalue_index(enum_type type, std::string name)
|
||||||
@@ -20,7 +19,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
template < detail::enum_kind Enum >
|
template < detail::enum_kind Enum >
|
||||||
evalue_index evalue_index::make(std::string name) {
|
evalue_index evalue_index::make(std::string name) {
|
||||||
return evalue_index{detail::resolve_type<Enum>(), std::move(name)};
|
return evalue_index{resolve_type<Enum>(), std::move(name)};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::size_t evalue_index::get_hash() const noexcept {
|
inline std::size_t evalue_index::get_hash() const noexcept {
|
||||||
|
|||||||
@@ -8,10 +8,9 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_indices.hpp"
|
#include "../meta_indices.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
inline function_index::function_index(function_type type, std::string name)
|
inline function_index::function_index(function_type type, std::string name)
|
||||||
@@ -20,7 +19,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
template < detail::function_kind Function >
|
template < detail::function_kind Function >
|
||||||
function_index function_index::make(std::string name) {
|
function_index function_index::make(std::string name) {
|
||||||
return function_index{detail::resolve_type<Function>(), std::move(name)};
|
return function_index{resolve_type<Function>(), std::move(name)};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::size_t function_index::get_hash() const noexcept {
|
inline std::size_t function_index::get_hash() const noexcept {
|
||||||
|
|||||||
@@ -8,10 +8,9 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_indices.hpp"
|
#include "../meta_indices.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
inline member_index::member_index(member_type type, std::string name)
|
inline member_index::member_index(member_type type, std::string name)
|
||||||
@@ -20,7 +19,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
template < detail::member_kind Member >
|
template < detail::member_kind Member >
|
||||||
member_index member_index::make(std::string name) {
|
member_index member_index::make(std::string name) {
|
||||||
return member_index{detail::resolve_type<Member>(), std::move(name)};
|
return member_index{resolve_type<Member>(), std::move(name)};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::size_t member_index::get_hash() const noexcept {
|
inline std::size_t member_index::get_hash() const noexcept {
|
||||||
|
|||||||
@@ -8,10 +8,9 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_indices.hpp"
|
#include "../meta_indices.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
inline method_index::method_index(method_type type, std::string name)
|
inline method_index::method_index(method_type type, std::string name)
|
||||||
@@ -20,7 +19,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
template < detail::method_kind Method >
|
template < detail::method_kind Method >
|
||||||
method_index method_index::make(std::string name) {
|
method_index method_index::make(std::string name) {
|
||||||
return method_index{detail::resolve_type<Method>(), std::move(name)};
|
return method_index{resolve_type<Method>(), std::move(name)};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::size_t method_index::get_hash() const noexcept {
|
inline std::size_t method_index::get_hash() const noexcept {
|
||||||
|
|||||||
@@ -8,10 +8,9 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_indices.hpp"
|
#include "../meta_indices.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_states.hpp"
|
#include "../meta_states.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
inline scope_index::scope_index(std::string name)
|
inline scope_index::scope_index(std::string name)
|
||||||
|
|||||||
@@ -8,10 +8,9 @@
|
|||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
#include "../meta_indices.hpp"
|
#include "../meta_indices.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
inline variable_index::variable_index(pointer_type type, std::string name)
|
inline variable_index::variable_index(pointer_type type, std::string name)
|
||||||
@@ -20,7 +19,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
template < detail::pointer_kind Pointer >
|
template < detail::pointer_kind Pointer >
|
||||||
variable_index variable_index::make(std::string name) {
|
variable_index variable_index::make(std::string name) {
|
||||||
return variable_index{detail::resolve_type<Pointer>(), std::move(name)};
|
return variable_index{resolve_type<Pointer>(), std::move(name)};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::size_t variable_index::get_hash() const noexcept {
|
inline std::size_t variable_index::get_hash() const noexcept {
|
||||||
|
|||||||
85
headers/meta.hpp/meta_registry.hpp
Normal file
85
headers/meta.hpp/meta_registry.hpp
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* 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-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "meta_base.hpp"
|
||||||
|
#include "meta_states.hpp"
|
||||||
|
#include "meta_types.hpp"
|
||||||
|
|
||||||
|
#include "meta_detail/state_registry.hpp"
|
||||||
|
#include "meta_detail/type_registry.hpp"
|
||||||
|
|
||||||
|
namespace meta_hpp
|
||||||
|
{
|
||||||
|
template < typename T >
|
||||||
|
[[nodiscard]] auto resolve_type() {
|
||||||
|
using namespace detail;
|
||||||
|
type_registry& registry = type_registry::instance();
|
||||||
|
return registry.resolve_type<std::remove_cv_t<T>>();
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename... Ts >
|
||||||
|
[[nodiscard]] std::vector<any_type> resolve_types() {
|
||||||
|
return { resolve_type<Ts>()... };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace meta_hpp
|
||||||
|
{
|
||||||
|
template < typename T >
|
||||||
|
// NOLINTNEXTLINE(readability-named-parameter)
|
||||||
|
[[nodiscard]] auto resolve_type(T&&) {
|
||||||
|
return resolve_type<std::remove_reference_t<T>>();
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename... Ts >
|
||||||
|
// NOLINTNEXTLINE(readability-named-parameter)
|
||||||
|
[[nodiscard]] std::vector<any_type> resolve_types(type_list<Ts...>) {
|
||||||
|
return { resolve_type<Ts>()... };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace meta_hpp
|
||||||
|
{
|
||||||
|
template < detail::class_kind Class, typename... Args >
|
||||||
|
constructor_type resolve_constructor_type() {
|
||||||
|
using namespace detail;
|
||||||
|
type_registry& registry = type_registry::instance();
|
||||||
|
return registry.resolve_constructor_type<Class, Args...>();
|
||||||
|
}
|
||||||
|
|
||||||
|
template < detail::class_kind Class >
|
||||||
|
destructor_type resolve_destructor_type() {
|
||||||
|
using namespace detail;
|
||||||
|
type_registry& registry = type_registry::instance();
|
||||||
|
return registry.resolve_destructor_type<Class>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace meta_hpp
|
||||||
|
{
|
||||||
|
template < typename T >
|
||||||
|
[[nodiscard]] any_type resolve_polymorphic_type(T&& v) noexcept {
|
||||||
|
#ifndef META_HPP_NO_RTTI
|
||||||
|
using namespace detail;
|
||||||
|
type_registry& registry = type_registry::instance();
|
||||||
|
return registry.get_type_by_rtti(typeid(v));
|
||||||
|
#else
|
||||||
|
(void)v;
|
||||||
|
return any_type{};
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace meta_hpp
|
||||||
|
{
|
||||||
|
[[nodiscard]] inline scope resolve_scope(std::string_view name) {
|
||||||
|
using namespace detail;
|
||||||
|
state_registry& registry = state_registry::instance();
|
||||||
|
return registry.resolve_scope(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_states.hpp"
|
#include "../meta_states.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
@@ -16,8 +17,6 @@
|
|||||||
#include "../meta_states/function.hpp"
|
#include "../meta_states/function.hpp"
|
||||||
#include "../meta_states/variable.hpp"
|
#include "../meta_states/variable.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp::detail
|
namespace meta_hpp::detail
|
||||||
{
|
{
|
||||||
inline scope_state_ptr scope_state::make(std::string name, metadata_map metadata) {
|
inline scope_state_ptr scope_state::make(std::string name, metadata_map metadata) {
|
||||||
@@ -99,7 +98,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
template < typename... Args >
|
template < typename... Args >
|
||||||
function scope::get_function_with(std::string_view name) const noexcept {
|
function scope::get_function_with(std::string_view name) const noexcept {
|
||||||
return get_function_with(name, {detail::resolve_type<Args>()...});
|
return get_function_with(name, {resolve_type<Args>()...});
|
||||||
}
|
}
|
||||||
|
|
||||||
template < typename Iter >
|
template < typename Iter >
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
#include "../meta_detail/type_traits/array_traits.hpp"
|
#include "../meta_detail/type_traits/array_traits.hpp"
|
||||||
|
|
||||||
namespace meta_hpp::detail
|
namespace meta_hpp::detail
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
#include "../meta_states/constructor.hpp"
|
#include "../meta_states/constructor.hpp"
|
||||||
@@ -15,7 +16,6 @@
|
|||||||
#include "../meta_states/method.hpp"
|
#include "../meta_states/method.hpp"
|
||||||
#include "../meta_states/variable.hpp"
|
#include "../meta_states/variable.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
#include "../meta_detail/type_traits/class_traits.hpp"
|
#include "../meta_detail/type_traits/class_traits.hpp"
|
||||||
|
|
||||||
namespace meta_hpp::detail
|
namespace meta_hpp::detail
|
||||||
@@ -133,7 +133,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
template < detail::class_kind Derived >
|
template < detail::class_kind Derived >
|
||||||
bool class_type::is_base_of() const noexcept {
|
bool class_type::is_base_of() const noexcept {
|
||||||
return is_base_of(detail::resolve_type<Derived>());
|
return is_base_of(resolve_type<Derived>());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool class_type::is_base_of(const class_type& derived) const noexcept {
|
inline bool class_type::is_base_of(const class_type& derived) const noexcept {
|
||||||
@@ -156,7 +156,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
template < detail::class_kind Base >
|
template < detail::class_kind Base >
|
||||||
bool class_type::is_derived_from() const noexcept {
|
bool class_type::is_derived_from() const noexcept {
|
||||||
return is_derived_from(detail::resolve_type<Base>());
|
return is_derived_from(resolve_type<Base>());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool class_type::is_derived_from(const class_type& base) const noexcept {
|
inline bool class_type::is_derived_from(const class_type& base) const noexcept {
|
||||||
@@ -263,7 +263,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
template < typename... Args >
|
template < typename... Args >
|
||||||
constructor class_type::get_constructor_with() const noexcept {
|
constructor class_type::get_constructor_with() const noexcept {
|
||||||
return get_constructor_with({detail::resolve_type<Args>()...});
|
return get_constructor_with({resolve_type<Args>()...});
|
||||||
}
|
}
|
||||||
|
|
||||||
template < typename Iter >
|
template < typename Iter >
|
||||||
@@ -291,7 +291,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
template < typename... Args >
|
template < typename... Args >
|
||||||
function class_type::get_function_with(std::string_view name) const noexcept {
|
function class_type::get_function_with(std::string_view name) const noexcept {
|
||||||
return get_function_with(name, {detail::resolve_type<Args>()...});
|
return get_function_with(name, {resolve_type<Args>()...});
|
||||||
}
|
}
|
||||||
|
|
||||||
template < typename Iter >
|
template < typename Iter >
|
||||||
@@ -330,7 +330,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
template < typename... Args >
|
template < typename... Args >
|
||||||
method class_type::get_method_with(std::string_view name) const noexcept {
|
method class_type::get_method_with(std::string_view name) const noexcept {
|
||||||
return get_method_with(name, {detail::resolve_type<Args>()...});
|
return get_method_with(name, {resolve_type<Args>()...});
|
||||||
}
|
}
|
||||||
|
|
||||||
template < typename Iter >
|
template < typename Iter >
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
#include "../meta_detail/type_traits/constructor_traits.hpp"
|
#include "../meta_detail/type_traits/constructor_traits.hpp"
|
||||||
|
|
||||||
namespace meta_hpp::detail
|
namespace meta_hpp::detail
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
#include "../meta_detail/type_traits/destructor_traits.hpp"
|
#include "../meta_detail/type_traits/destructor_traits.hpp"
|
||||||
|
|
||||||
namespace meta_hpp::detail
|
namespace meta_hpp::detail
|
||||||
|
|||||||
@@ -7,11 +7,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
#include "../meta_states/evalue.hpp"
|
#include "../meta_states/evalue.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
#include "../meta_detail/type_traits/enum_traits.hpp"
|
#include "../meta_detail/type_traits/enum_traits.hpp"
|
||||||
#include "../meta_detail/value_utilities/uarg.hpp"
|
#include "../meta_detail/value_utilities/uarg.hpp"
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
#include "../meta_detail/type_traits/function_traits.hpp"
|
#include "../meta_detail/type_traits/function_traits.hpp"
|
||||||
|
|
||||||
namespace meta_hpp::detail
|
namespace meta_hpp::detail
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
#include "../meta_detail/type_traits/member_traits.hpp"
|
#include "../meta_detail/type_traits/member_traits.hpp"
|
||||||
|
|
||||||
namespace meta_hpp::detail
|
namespace meta_hpp::detail
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
#include "../meta_detail/type_traits/method_traits.hpp"
|
#include "../meta_detail/type_traits/method_traits.hpp"
|
||||||
|
|
||||||
namespace meta_hpp::detail
|
namespace meta_hpp::detail
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
namespace meta_hpp::detail
|
namespace meta_hpp::detail
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_traits/number_traits.hpp"
|
#include "../meta_detail/type_traits/number_traits.hpp"
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
#include "../meta_detail/type_traits/pointer_traits.hpp"
|
#include "../meta_detail/type_traits/pointer_traits.hpp"
|
||||||
|
|
||||||
namespace meta_hpp::detail
|
namespace meta_hpp::detail
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
#include "../meta_detail/type_traits/reference_traits.hpp"
|
#include "../meta_detail/type_traits/reference_traits.hpp"
|
||||||
|
|
||||||
namespace meta_hpp::detail
|
namespace meta_hpp::detail
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_types.hpp"
|
#include "../meta_types.hpp"
|
||||||
|
|
||||||
namespace meta_hpp::detail
|
namespace meta_hpp::detail
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../meta_base.hpp"
|
#include "../meta_base.hpp"
|
||||||
|
#include "../meta_registry.hpp"
|
||||||
#include "../meta_uvalue.hpp"
|
#include "../meta_uvalue.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/value_traits/deref_traits.hpp"
|
#include "../meta_detail/value_traits/deref_traits.hpp"
|
||||||
@@ -16,8 +17,6 @@
|
|||||||
#include "../meta_detail/value_traits/less_traits.hpp"
|
#include "../meta_detail/value_traits/less_traits.hpp"
|
||||||
#include "../meta_detail/value_traits/ostream_traits.hpp"
|
#include "../meta_detail/value_traits/ostream_traits.hpp"
|
||||||
|
|
||||||
#include "../meta_detail/type_registry.hpp"
|
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
struct uvalue::vtable_t final {
|
struct uvalue::vtable_t final {
|
||||||
@@ -118,7 +117,7 @@ namespace meta_hpp
|
|||||||
// NOLINTNEXTLINE(readability-function-cognitive-complexity)
|
// NOLINTNEXTLINE(readability-function-cognitive-complexity)
|
||||||
static vtable_t* get() {
|
static vtable_t* get() {
|
||||||
static vtable_t table{
|
static vtable_t table{
|
||||||
.type = detail::resolve_type<Tp>(),
|
.type = resolve_type<Tp>(),
|
||||||
|
|
||||||
.data = [](storage_u& from) noexcept -> void* {
|
.data = [](storage_u& from) noexcept -> void* {
|
||||||
return storage_cast<Tp>(from);
|
return storage_cast<Tp>(from);
|
||||||
@@ -302,7 +301,7 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline const any_type& uvalue::get_type() const noexcept {
|
inline const any_type& uvalue::get_type() const noexcept {
|
||||||
static any_type void_type = detail::resolve_type<void>();
|
static any_type void_type = resolve_type<void>();
|
||||||
return vtable_ != nullptr ? vtable_->type : void_type;
|
return vtable_ != nullptr ? vtable_->type : void_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,7 +364,7 @@ namespace meta_hpp
|
|||||||
template < typename T >
|
template < typename T >
|
||||||
std::decay_t<T>* uvalue::try_cast() noexcept {
|
std::decay_t<T>* uvalue::try_cast() noexcept {
|
||||||
using Tp = std::decay_t<T>;
|
using Tp = std::decay_t<T>;
|
||||||
return get_type() == detail::resolve_type<Tp>()
|
return get_type() == resolve_type<Tp>()
|
||||||
? vtable_t::storage_cast<Tp>(storage_)
|
? vtable_t::storage_cast<Tp>(storage_)
|
||||||
: nullptr;
|
: nullptr;
|
||||||
}
|
}
|
||||||
@@ -373,7 +372,7 @@ namespace meta_hpp
|
|||||||
template < typename T >
|
template < typename T >
|
||||||
const std::decay_t<T>* uvalue::try_cast() const noexcept {
|
const std::decay_t<T>* uvalue::try_cast() const noexcept {
|
||||||
using Tp = std::decay_t<T>;
|
using Tp = std::decay_t<T>;
|
||||||
return get_type() == detail::resolve_type<Tp>()
|
return get_type() == resolve_type<Tp>()
|
||||||
? vtable_t::storage_cast<Tp>(storage_)
|
? vtable_t::storage_cast<Tp>(storage_)
|
||||||
: nullptr;
|
: nullptr;
|
||||||
}
|
}
|
||||||
@@ -388,7 +387,7 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
|
|
||||||
const any_type& l_type = l.get_type();
|
const any_type& l_type = l.get_type();
|
||||||
const any_type& r_type = detail::resolve_type<T>();
|
const any_type& r_type = resolve_type<T>();
|
||||||
|
|
||||||
return (l_type < r_type) || (l_type == r_type && l.cast<T>() < r);
|
return (l_type < r_type) || (l_type == r_type && l.cast<T>() < r);
|
||||||
}
|
}
|
||||||
@@ -399,7 +398,7 @@ namespace meta_hpp
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const any_type& l_type = detail::resolve_type<T>();
|
const any_type& l_type = resolve_type<T>();
|
||||||
const any_type& r_type = r.get_type();
|
const any_type& r_type = r.get_type();
|
||||||
|
|
||||||
return (l_type < r_type) || (l_type == r_type && l < r.cast<T>());
|
return (l_type < r_type) || (l_type == r_type && l < r.cast<T>());
|
||||||
@@ -430,7 +429,7 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
|
|
||||||
const any_type& l_type = l.get_type();
|
const any_type& l_type = l.get_type();
|
||||||
const any_type& r_type = detail::resolve_type<T>();
|
const any_type& r_type = resolve_type<T>();
|
||||||
|
|
||||||
return l_type == r_type && l.cast<T>() == r;
|
return l_type == r_type && l.cast<T>() == r;
|
||||||
}
|
}
|
||||||
@@ -441,7 +440,7 @@ namespace meta_hpp
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const any_type& l_type = detail::resolve_type<T>();
|
const any_type& l_type = resolve_type<T>();
|
||||||
const any_type& r_type = r.get_type();
|
const any_type& r_type = r.get_type();
|
||||||
|
|
||||||
return l_type == r_type && l == r.cast<T>();
|
return l_type == r_type && l == r.cast<T>();
|
||||||
|
|||||||
Reference in New Issue
Block a user