fix invoke functions specs

This commit is contained in:
BlackMATov
2023-03-13 08:11:41 +07:00
parent abe42e1edc
commit b5919660c6
11 changed files with 104 additions and 68 deletions

View File

@@ -222,10 +222,10 @@ namespace meta_hpp
using metadata_map = std::map<std::string, uvalue, std::less<>>;
using typedef_map = std::map<std::string, any_type, std::less<>>;
using any_type_list = std::vector<any_type>;
using class_list = std::vector<class_type>;
using enum_list = std::vector<enum_type>;
using any_type_list = std::vector<any_type>;
using argument_list = std::vector<argument>;
using constructor_list = std::vector<constructor>;
using destructor_list = std::vector<destructor>;

View File

@@ -341,7 +341,7 @@ namespace meta_hpp::detail
namespace meta_hpp::detail
{
template < typename ArgTypeList >
bool can_cast_all_uargs(type_registry& registry, std::span<const uarg> args) {
bool can_cast_all_uargs(type_registry& registry, std::span<const uarg> args) noexcept {
if ( args.size() != type_list_arity_v<ArgTypeList> ) {
return false;
}
@@ -352,7 +352,7 @@ namespace meta_hpp::detail
}
template < typename ArgTypeList >
bool can_cast_all_uargs(type_registry& registry, std::span<const uarg_base> args) {
bool can_cast_all_uargs(type_registry& registry, std::span<const uarg_base> args) noexcept {
if ( args.size() != type_list_arity_v<ArgTypeList> ) {
return false;
}

View File

@@ -15,8 +15,14 @@ namespace meta_hpp
template < typename... Args >
uvalue invoke(const function& function, Args&&... args);
template < typename... Args >
uresult try_invoke(const function& function, Args&&... args);
template < detail::function_pointer_kind Function, typename... Args >
uvalue invoke(Function function_ptr, Args&&... args);
template < detail::function_pointer_kind Function, typename... Args >
uresult try_invoke(Function function_ptr, Args&&... args);
}
namespace meta_hpp
@@ -24,8 +30,14 @@ namespace meta_hpp
template < typename Instance >
uvalue invoke(const member& member, Instance&& instance);
template < typename Instance >
uresult try_invoke(const member& member, Instance&& instance);
template < detail::member_pointer_kind Member, typename Instance >
uvalue invoke(Member member_ptr, Instance&& instance);
template < detail::member_pointer_kind Member, typename Instance >
uresult try_invoke(Member member_ptr, Instance&& instance);
}
namespace meta_hpp
@@ -33,51 +45,57 @@ namespace meta_hpp
template < typename Instance, typename... Args >
uvalue invoke(const method& method, Instance&& instance, Args&&... args);
template < typename Instance, typename... Args >
uresult try_invoke(const method& method, Instance&& instance, Args&&... args);
template < detail::method_pointer_kind Method, typename Instance, typename... Args >
uvalue invoke(Method method_ptr, Instance&& instance, Args&&... args);
template < detail::method_pointer_kind Method, typename Instance, typename... Args >
uresult try_invoke(Method method_ptr, Instance&& instance, Args&&... args);
}
namespace meta_hpp
{
template < typename... Args >
bool is_invocable_with(const function& function);
bool is_invocable_with(const function& function) noexcept;
template < typename... Args >
bool is_invocable_with(const function& function, Args&&... args);
bool is_invocable_with(const function& function, Args&&... args) noexcept;
template < typename... Args, detail::function_pointer_kind Function >
bool is_invocable_with(Function);
bool is_invocable_with(Function) noexcept;
template < typename... Args, detail::function_pointer_kind Function >
bool is_invocable_with(Function, Args&&... args);
bool is_invocable_with(Function, Args&&... args) noexcept;
}
namespace meta_hpp
{
template < typename Instance >
bool is_invocable_with(const member& member);
bool is_invocable_with(const member& member) noexcept;
template < typename Instance >
bool is_invocable_with(const member& member, Instance&& instance);
bool is_invocable_with(const member& member, Instance&& instance) noexcept;
template < typename Instance, detail::member_pointer_kind Member >
bool is_invocable_with(Member);
bool is_invocable_with(Member) noexcept;
template < typename Instance, detail::member_pointer_kind Member >
bool is_invocable_with(Member, Instance&& instance);
bool is_invocable_with(Member, Instance&& instance) noexcept;
}
namespace meta_hpp
{
template < typename Instance, typename... Args >
bool is_invocable_with(const method& method);
bool is_invocable_with(const method& method) noexcept;
template < typename Instance, typename... Args >
bool is_invocable_with(const method& method, Instance&& instance, Args&&... args);
bool is_invocable_with(const method& method, Instance&& instance, Args&&... args) noexcept;
template < typename Instance, typename... Args, detail::method_pointer_kind Method >
bool is_invocable_with(Method);
bool is_invocable_with(Method) noexcept;
template < typename Instance, typename... Args, detail::method_pointer_kind Method >
bool is_invocable_with(Method, Instance&& instance, Args&&... args);
bool is_invocable_with(Method, Instance&& instance, Args&&... args) noexcept;
}

View File

@@ -134,17 +134,17 @@ namespace meta_hpp
namespace meta_hpp
{
template < typename... Args >
bool is_invocable_with(const function& function) {
bool is_invocable_with(const function& function) noexcept {
return function.is_invocable_with<Args...>();
}
template < typename... Args >
bool is_invocable_with(const function& function, Args&&... args) {
bool is_invocable_with(const function& function, Args&&... args) noexcept {
return function.is_invocable_with(std::forward<Args>(args)...);
}
template < typename... Args, detail::function_pointer_kind Function >
bool is_invocable_with(Function) {
bool is_invocable_with(Function) noexcept {
using namespace detail;
type_registry& registry{type_registry::instance()};
const std::array<uarg_base, sizeof...(Args)> vargs{uarg_base{registry, type_list<Args>{}}...};
@@ -152,7 +152,7 @@ namespace meta_hpp
}
template < typename... Args, detail::function_pointer_kind Function >
bool is_invocable_with(Function, Args&&... args) {
bool is_invocable_with(Function, Args&&... args) noexcept {
using namespace detail;
type_registry& registry{type_registry::instance()};
const std::array<uarg_base, sizeof...(Args)> vargs{uarg_base{registry, std::forward<Args>(args)}...};
@@ -163,17 +163,17 @@ namespace meta_hpp
namespace meta_hpp
{
template < typename Instance >
bool is_invocable_with(const member& member) {
bool is_invocable_with(const member& member) noexcept {
return member.is_gettable_with<Instance>();
}
template < typename Instance >
bool is_invocable_with(const member& member, Instance&& instance) {
bool is_invocable_with(const member& member, Instance&& instance) noexcept {
return member.is_gettable_with(std::forward<Instance>(instance));
}
template < typename Instance, detail::member_pointer_kind Member >
bool is_invocable_with(Member) {
bool is_invocable_with(Member) noexcept {
using namespace detail;
type_registry& registry{type_registry::instance()};
const uinst_base vinst{registry, type_list<Instance>{}};
@@ -181,7 +181,7 @@ namespace meta_hpp
}
template < typename Instance, detail::member_pointer_kind Member >
bool is_invocable_with(Member, Instance&& instance) {
bool is_invocable_with(Member, Instance&& instance) noexcept {
using namespace detail;
type_registry& registry{type_registry::instance()};
const uinst_base vinst{registry, std::forward<Instance>(instance)};
@@ -192,17 +192,17 @@ namespace meta_hpp
namespace meta_hpp
{
template < typename Instance, typename... Args >
bool is_invocable_with(const method& method) {
bool is_invocable_with(const method& method) noexcept {
return method.is_invocable_with<Instance, Args...>();
}
template < typename Instance, typename... Args >
bool is_invocable_with(const method& method, Instance&& instance, Args&&... args) {
bool is_invocable_with(const method& method, Instance&& instance, Args&&... args) noexcept {
return method.is_invocable_with(std::forward<Instance>(instance), std::forward<Args>(args)...);
}
template < typename Instance, typename... Args, detail::method_pointer_kind Method >
bool is_invocable_with(Method) {
bool is_invocable_with(Method) noexcept {
using namespace detail;
type_registry& registry{type_registry::instance()};
const uinst_base vinst{registry, type_list<Instance>{}};
@@ -211,7 +211,7 @@ namespace meta_hpp
}
template < typename Instance, typename... Args, detail::method_pointer_kind Method >
bool is_invocable_with(Method, Instance&& instance, Args&&... args) {
bool is_invocable_with(Method, Instance&& instance, Args&&... args) noexcept {
using namespace detail;
type_registry& registry{type_registry::instance()};
const uinst_base vinst{registry, std::forward<Instance>(instance)};

View File

@@ -80,7 +80,7 @@ namespace meta_hpp::detail
}
template < class_kind Class, typename... Args >
uerror raw_constructor_create_error(type_registry& registry, std::span<const uarg_base> args) {
uerror raw_constructor_create_error(type_registry& registry, std::span<const uarg_base> args) noexcept {
using ct = constructor_traits<Class, Args...>;
using argument_types = typename ct::argument_types;

View File

@@ -37,7 +37,7 @@ namespace meta_hpp::detail
}
template < class_kind Class >
uerror raw_destructor_destroy_error(type_registry& registry, const uarg_base& arg) {
uerror raw_destructor_destroy_error(type_registry& registry, const uarg_base& arg) noexcept {
using dt = destructor_traits<Class>;
using class_type = typename dt::class_type;

View File

@@ -64,7 +64,7 @@ namespace meta_hpp::detail
}
template < function_pointer_kind Function >
uerror raw_function_invoke_error(type_registry& registry, std::span<const uarg_base> args) {
uerror raw_function_invoke_error(type_registry& registry, std::span<const uarg_base> args) noexcept {
using ft = function_traits<Function>;
using argument_types = typename ft::argument_types;

View File

@@ -76,7 +76,7 @@ namespace meta_hpp::detail
}
template < member_pointer_kind Member >
uerror raw_member_getter_error(type_registry& registry, const uinst_base& inst) {
uerror raw_member_getter_error(type_registry& registry, const uinst_base& inst) noexcept {
using mt = member_traits<Member>;
using class_type = typename mt::class_type;
@@ -129,7 +129,7 @@ namespace meta_hpp::detail
}
template < member_pointer_kind Member >
uerror raw_member_setter_error(type_registry& registry, const uinst_base& inst, const uarg_base& arg) {
uerror raw_member_setter_error(type_registry& registry, const uinst_base& inst, const uarg_base& arg) noexcept {
using mt = member_traits<Member>;
using class_type = typename mt::class_type;
using value_type = typename mt::value_type;

View File

@@ -71,7 +71,7 @@ namespace meta_hpp::detail
}
template < method_pointer_kind Method >
uerror raw_method_invoke_error(type_registry& registry, const uinst_base& inst, std::span<const uarg_base> args) {
uerror raw_method_invoke_error(type_registry& registry, const uinst_base& inst, std::span<const uarg_base> args) noexcept {
using mt = method_traits<Method>;
using qualified_type = typename mt::qualified_type;
using argument_types = typename mt::argument_types;

View File

@@ -68,7 +68,7 @@ namespace meta_hpp::detail
}
template < pointer_kind Pointer >
uerror raw_variable_setter_error(type_registry& registry, const uarg_base& arg) {
uerror raw_variable_setter_error(type_registry& registry, const uarg_base& arg) noexcept {
using pt = pointer_traits<Pointer>;
using data_type = typename pt::data_type;