mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-13 03:08:49 +07:00
remove "resolve_types" functions
This commit is contained in:
@@ -55,20 +55,6 @@ namespace meta_hpp
|
||||
return registry.resolve_type<raw_type>();
|
||||
}
|
||||
}
|
||||
|
||||
template < typename... Ts >
|
||||
[[nodiscard]] any_type_list resolve_types() {
|
||||
using namespace detail;
|
||||
type_registry& registry = type_registry::instance();
|
||||
return {registry.resolve_type<std::remove_cv_t<Ts>>()...};
|
||||
}
|
||||
|
||||
template < typename... Ts >
|
||||
[[nodiscard]] any_type_list resolve_types(type_list<Ts...>) {
|
||||
using namespace detail;
|
||||
type_registry& registry = type_registry::instance();
|
||||
return {registry.resolve_type<std::remove_cv_t<Ts>>()...};
|
||||
}
|
||||
}
|
||||
|
||||
namespace meta_hpp
|
||||
|
||||
@@ -12,6 +12,27 @@
|
||||
|
||||
#include "../meta_detail/type_traits/constructor_traits.hpp"
|
||||
|
||||
namespace meta_hpp::detail::constructor_type_data_impl
|
||||
{
|
||||
template < class_kind Class, typename... Args >
|
||||
any_type_list make_argument_types() {
|
||||
using ct = constructor_traits<Class, Args...>;
|
||||
using ct_argument_types = typename ct::argument_types;
|
||||
|
||||
return []<std::size_t... Is>(std::index_sequence<Is...>) {
|
||||
any_type_list argument_types;
|
||||
argument_types.reserve(type_list_arity_v<ct_argument_types>);
|
||||
|
||||
[[maybe_unused]] const auto make_argument_type = []<std::size_t I>(index_constant<I>) {
|
||||
return resolve_type<type_list_at_t<I, ct_argument_types>>();
|
||||
};
|
||||
|
||||
(argument_types.emplace_back(make_argument_type(index_constant<Is>{})), ...);
|
||||
return argument_types;
|
||||
}(std::make_index_sequence<type_list_arity_v<ct_argument_types>>());
|
||||
}
|
||||
}
|
||||
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < class_kind Class, typename... Args >
|
||||
@@ -19,7 +40,7 @@ namespace meta_hpp::detail
|
||||
: type_data_base{type_kind::constructor_}
|
||||
, flags{constructor_traits<Class, Args...>::make_flags()}
|
||||
, owner_type{resolve_type<typename constructor_traits<Class, Args...>::class_type>()}
|
||||
, argument_types{resolve_types(typename constructor_traits<Class, Args...>::argument_types{})} {}
|
||||
, argument_types{constructor_type_data_impl::make_argument_types<Class, Args...>()} {}
|
||||
}
|
||||
|
||||
namespace meta_hpp
|
||||
|
||||
@@ -12,6 +12,27 @@
|
||||
|
||||
#include "../meta_detail/type_traits/function_traits.hpp"
|
||||
|
||||
namespace meta_hpp::detail::function_type_data_impl
|
||||
{
|
||||
template < function_kind Function >
|
||||
any_type_list make_argument_types() {
|
||||
using ft = function_traits<Function>;
|
||||
using ft_argument_types = typename ft::argument_types;
|
||||
|
||||
return []<std::size_t... Is>(std::index_sequence<Is...>) {
|
||||
any_type_list argument_types;
|
||||
argument_types.reserve(type_list_arity_v<ft_argument_types>);
|
||||
|
||||
[[maybe_unused]] const auto make_argument_type = []<std::size_t I>(index_constant<I>) {
|
||||
return resolve_type<type_list_at_t<I, ft_argument_types>>();
|
||||
};
|
||||
|
||||
(argument_types.emplace_back(make_argument_type(index_constant<Is>{})), ...);
|
||||
return argument_types;
|
||||
}(std::make_index_sequence<type_list_arity_v<ft_argument_types>>());
|
||||
}
|
||||
}
|
||||
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < function_kind Function >
|
||||
@@ -19,7 +40,7 @@ namespace meta_hpp::detail
|
||||
: type_data_base{type_kind::function_}
|
||||
, flags{function_traits<Function>::make_flags()}
|
||||
, return_type{resolve_type<typename function_traits<Function>::return_type>()}
|
||||
, argument_types{resolve_types(typename function_traits<Function>::argument_types{})} {}
|
||||
, argument_types{function_type_data_impl::make_argument_types<Function>()} {}
|
||||
}
|
||||
|
||||
namespace meta_hpp
|
||||
|
||||
@@ -12,6 +12,27 @@
|
||||
|
||||
#include "../meta_detail/type_traits/method_traits.hpp"
|
||||
|
||||
namespace meta_hpp::detail::method_type_data_impl
|
||||
{
|
||||
template < method_pointer_kind Method >
|
||||
any_type_list make_argument_types() {
|
||||
using mt = method_traits<Method>;
|
||||
using mt_argument_types = typename mt::argument_types;
|
||||
|
||||
return []<std::size_t... Is>(std::index_sequence<Is...>) {
|
||||
any_type_list argument_types;
|
||||
argument_types.reserve(type_list_arity_v<mt_argument_types>);
|
||||
|
||||
[[maybe_unused]] const auto make_argument_type = []<std::size_t I>(index_constant<I>) {
|
||||
return resolve_type<type_list_at_t<I, mt_argument_types>>();
|
||||
};
|
||||
|
||||
(argument_types.emplace_back(make_argument_type(index_constant<Is>{})), ...);
|
||||
return argument_types;
|
||||
}(std::make_index_sequence<type_list_arity_v<mt_argument_types>>());
|
||||
}
|
||||
}
|
||||
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < method_pointer_kind Method >
|
||||
@@ -20,7 +41,7 @@ namespace meta_hpp::detail
|
||||
, 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>()}
|
||||
, argument_types{resolve_types(typename method_traits<Method>::argument_types{})} {}
|
||||
, argument_types{method_type_data_impl::make_argument_types<Method>()} {}
|
||||
}
|
||||
|
||||
namespace meta_hpp
|
||||
|
||||
Reference in New Issue
Block a user