move meta_invoke to top headers

This commit is contained in:
BlackMATov
2023-02-09 18:40:53 +07:00
parent 874fae2bab
commit 937dbe20c8
4 changed files with 785 additions and 636 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -33,6 +33,9 @@
#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_invoke.hpp"
#include "meta_invoke/invoke.hpp"
#include "meta_registry.hpp" #include "meta_registry.hpp"
#include "meta_states.hpp" #include "meta_states.hpp"
@@ -63,5 +66,4 @@
#include "meta_types/void_type.hpp" #include "meta_types/void_type.hpp"
#include "meta_uvalue.hpp" #include "meta_uvalue.hpp"
#include "meta_uvalue/invoke.hpp"
#include "meta_uvalue/uvalue.hpp" #include "meta_uvalue/uvalue.hpp"

View File

@@ -0,0 +1,83 @@
/*******************************************************************************
* 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-2023, by Matvey Cherevko (blackmatov@gmail.com)
******************************************************************************/
#pragma once
#include "meta_base.hpp"
#include "meta_states.hpp"
#include "meta_uvalue.hpp"
namespace meta_hpp
{
template < typename... Args >
uvalue invoke(const function& function, Args&&... args);
template < detail::function_pointer_kind Function, typename... Args >
uvalue invoke(Function function_ptr, Args&&... args);
}
namespace meta_hpp
{
template < typename Instance >
uvalue invoke(const member& member, Instance&& instance);
template < detail::member_pointer_kind Member, typename Instance >
uvalue invoke(Member member_ptr, Instance&& instance);
}
namespace meta_hpp
{
template < typename Instance, typename... Args >
uvalue 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);
}
namespace meta_hpp
{
template < typename... Args >
bool is_invocable_with(const function& function);
template < typename... Args >
bool is_invocable_with(const function& function, Args&&... args);
template < detail::function_pointer_kind Function, typename... Args >
bool is_invocable_with();
template < detail::function_pointer_kind Function, typename... Args >
bool is_invocable_with(Args&&... args);
}
namespace meta_hpp
{
template < typename Instance >
bool is_invocable_with(const member& member);
template < typename Instance >
bool is_invocable_with(const member& member, Instance&& instance);
template < detail::member_pointer_kind Member, typename Instance >
bool is_invocable_with();
template < detail::member_pointer_kind Member, typename Instance >
bool is_invocable_with(Instance&& instance);
}
namespace meta_hpp
{
template < typename Instance, typename... Args >
bool is_invocable_with(const method& method);
template < typename Instance, typename... Args >
bool is_invocable_with(const method& method, Instance&& instance, Args&&... args);
template < detail::method_pointer_kind Method, typename Instance, typename... Args >
bool is_invocable_with();
template < detail::method_pointer_kind Method, typename Instance, typename... Args >
bool is_invocable_with(Instance&& instance, Args&&... args);
}

View File

@@ -7,8 +7,12 @@
#pragma once #pragma once
#include "../meta_base.hpp" #include "../meta_base.hpp"
#include "../meta_invoke.hpp"
#include "../meta_states.hpp" #include "../meta_states.hpp"
#include "../meta_uvalue.hpp"
#include "../meta_states/function.hpp"
#include "../meta_states/member.hpp"
#include "../meta_states/method.hpp"
#include "../meta_detail/value_utilities/uarg.hpp" #include "../meta_detail/value_utilities/uarg.hpp"
#include "../meta_detail/value_utilities/uinst.hpp" #include "../meta_detail/value_utilities/uinst.hpp"
@@ -113,23 +117,7 @@ namespace meta_hpp
bool is_invocable_with(const member& member, Instance&& instance) { bool is_invocable_with(const member& member, Instance&& instance) {
return member.is_gettable_with(std::forward<Instance>(instance)); return member.is_gettable_with(std::forward<Instance>(instance));
} }
}
namespace meta_hpp
{
template < typename Instance, typename... Args >
bool is_invocable_with(const method& method) {
return method.is_invocable_with<Instance, Args...>();
}
template < typename Instance, typename... Args >
bool is_invocable_with(const method& method, Instance&& instance, Args&&... args) {
return method.is_invocable_with(std::forward<Instance>(instance), std::forward<Args>(args)...);
}
}
namespace meta_hpp
{
template < detail::member_pointer_kind Member, typename Instance > template < detail::member_pointer_kind Member, typename Instance >
bool is_invocable_with() { bool is_invocable_with() {
using namespace detail; using namespace detail;
@@ -147,6 +135,16 @@ namespace meta_hpp
namespace meta_hpp namespace meta_hpp
{ {
template < typename Instance, typename... Args >
bool is_invocable_with(const method& method) {
return method.is_invocable_with<Instance, Args...>();
}
template < typename Instance, typename... Args >
bool is_invocable_with(const method& method, Instance&& instance, Args&&... args) {
return method.is_invocable_with(std::forward<Instance>(instance), std::forward<Args>(args)...);
}
template < detail::method_pointer_kind Method, typename Instance, typename... Args > template < detail::method_pointer_kind Method, typename Instance, typename... Args >
bool is_invocable_with() { bool is_invocable_with() {
using namespace detail; using namespace detail;