diff --git a/headers/meta.hpp/meta_binds.hpp b/headers/meta.hpp/meta_binds.hpp index 66d3e0d..6aa92d1 100644 --- a/headers/meta.hpp/meta_binds.hpp +++ b/headers/meta.hpp/meta_binds.hpp @@ -111,12 +111,12 @@ namespace meta_hpp // constructor_ template < typename... Args - , constructor_policy_kind Policy = constructor_policy::as_object > + , constructor_policy_kind Policy = constructor_policy::as_object_t > class_bind& constructor_(Policy = Policy{}) requires detail::class_bind_constructor_kind; template < typename... Args - , constructor_policy_kind Policy = constructor_policy::as_object > + , constructor_policy_kind Policy = constructor_policy::as_object_t > class_bind& constructor_(constructor_opts opts, Policy = Policy{}) requires detail::class_bind_constructor_kind; @@ -131,14 +131,14 @@ namespace meta_hpp // function_ template < detail::function_kind Function - , function_policy_kind Policy = function_policy::as_copy > + , function_policy_kind Policy = function_policy::as_copy_t > class_bind& function_( std::string name, Function function, Policy = Policy{}); template < detail::function_kind Function - , function_policy_kind Policy = function_policy::as_copy > + , function_policy_kind Policy = function_policy::as_copy_t > class_bind& function_( std::string name, Function function, @@ -146,7 +146,7 @@ namespace meta_hpp Policy = Policy{}); template < detail::function_kind Function - , function_policy_kind Policy = function_policy::as_copy > + , function_policy_kind Policy = function_policy::as_copy_t > class_bind& function_( std::string name, Function function, @@ -156,7 +156,7 @@ namespace meta_hpp // member_ template < detail::member_kind Member - , member_policy_kind Policy = member_policy::as_copy > + , member_policy_kind Policy = member_policy::as_copy_t > class_bind& member_( std::string name, Member member, @@ -164,7 +164,7 @@ namespace meta_hpp requires detail::class_bind_member_kind; template < detail::member_kind Member - , member_policy_kind Policy = member_policy::as_copy > + , member_policy_kind Policy = member_policy::as_copy_t > class_bind& member_( std::string name, Member member, @@ -175,7 +175,7 @@ namespace meta_hpp // method_ template < detail::method_kind Method - , method_policy_kind Policy = method_policy::as_copy > + , method_policy_kind Policy = method_policy::as_copy_t > class_bind& method_( std::string name, Method method, @@ -183,7 +183,7 @@ namespace meta_hpp requires detail::class_bind_method_kind; template < detail::method_kind Method - , method_policy_kind Policy = method_policy::as_copy > + , method_policy_kind Policy = method_policy::as_copy_t > class_bind& method_( std::string name, Method method, @@ -192,7 +192,7 @@ namespace meta_hpp requires detail::class_bind_method_kind; template < detail::method_kind Method - , method_policy_kind Policy = method_policy::as_copy > + , method_policy_kind Policy = method_policy::as_copy_t > class_bind& method_( std::string name, Method method, @@ -208,14 +208,14 @@ namespace meta_hpp // variable_ template < detail::pointer_kind Pointer - , variable_policy_kind Policy = variable_policy::as_copy > + , variable_policy_kind Policy = variable_policy::as_copy_t > class_bind& variable_( std::string name, Pointer pointer, Policy = Policy{}); template < detail::pointer_kind Pointer - , variable_policy_kind Policy = variable_policy::as_copy > + , variable_policy_kind Policy = variable_policy::as_copy_t > class_bind& variable_( std::string name, Pointer pointer, @@ -361,14 +361,14 @@ namespace meta_hpp // function_ template < detail::function_kind Function - , function_policy_kind Policy = function_policy::as_copy > + , function_policy_kind Policy = function_policy::as_copy_t > scope_bind& function_( std::string name, Function function, Policy = Policy{}); template < detail::function_kind Function - , function_policy_kind Policy = function_policy::as_copy > + , function_policy_kind Policy = function_policy::as_copy_t > scope_bind& function_( std::string name, Function function, @@ -376,7 +376,7 @@ namespace meta_hpp Policy = Policy{}); template < detail::function_kind Function - , function_policy_kind Policy = function_policy::as_copy > + , function_policy_kind Policy = function_policy::as_copy_t > scope_bind& function_( std::string name, Function function, @@ -391,14 +391,14 @@ namespace meta_hpp // variable_ template < detail::pointer_kind Pointer - , variable_policy_kind Policy = variable_policy::as_copy > + , variable_policy_kind Policy = variable_policy::as_copy_t > scope_bind& variable_( std::string name, Pointer pointer, Policy = Policy{}); template < detail::pointer_kind Pointer - , variable_policy_kind Policy = variable_policy::as_copy > + , variable_policy_kind Policy = variable_policy::as_copy_t > scope_bind& variable_( std::string name, Pointer pointer, diff --git a/headers/meta.hpp/meta_detail/index_family.hpp b/headers/meta.hpp/meta_detail/index_family.hpp index b0b40ea..8fdbb7a 100644 --- a/headers/meta.hpp/meta_detail/index_family.hpp +++ b/headers/meta.hpp/meta_detail/index_family.hpp @@ -11,7 +11,7 @@ namespace meta_hpp::detail { template < typename T > - inline constexpr bool is_index_family_v = + concept index_family = std::same_as || std::same_as || std::same_as || @@ -21,7 +21,4 @@ namespace meta_hpp::detail std::same_as || std::same_as || std::same_as; - - template < typename T > - concept index_family = is_index_family_v; } diff --git a/headers/meta.hpp/meta_detail/state_family.hpp b/headers/meta.hpp/meta_detail/state_family.hpp index 04755b1..4c33b18 100644 --- a/headers/meta.hpp/meta_detail/state_family.hpp +++ b/headers/meta.hpp/meta_detail/state_family.hpp @@ -11,7 +11,7 @@ namespace meta_hpp::detail { template < typename T > - inline constexpr bool is_state_family_v = + concept state_family = std::same_as || std::same_as || std::same_as || @@ -22,9 +22,6 @@ namespace meta_hpp::detail std::same_as || std::same_as; - template < typename T > - concept state_family = is_state_family_v; - template < state_family T > [[nodiscard]] auto state_access(const T& state) { return state.state_; diff --git a/headers/meta.hpp/meta_detail/type_family.hpp b/headers/meta.hpp/meta_detail/type_family.hpp index d73c0a4..1baf5a1 100644 --- a/headers/meta.hpp/meta_detail/type_family.hpp +++ b/headers/meta.hpp/meta_detail/type_family.hpp @@ -11,7 +11,7 @@ namespace meta_hpp::detail { template < typename T > - inline constexpr bool is_type_family_v = + concept type_family = std::same_as || std::same_as || std::same_as || @@ -27,9 +27,6 @@ namespace meta_hpp::detail std::same_as || std::same_as; - template < typename T > - concept type_family = is_type_family_v; - template < type_family T > [[nodiscard]] auto type_access(const T& type) { return type.data_; diff --git a/headers/meta.hpp/meta_detail/value_utilities/uarg.hpp b/headers/meta.hpp/meta_detail/value_utilities/uarg.hpp index be64188..dcfcc5d 100644 --- a/headers/meta.hpp/meta_detail/value_utilities/uarg.hpp +++ b/headers/meta.hpp/meta_detail/value_utilities/uarg.hpp @@ -36,12 +36,8 @@ namespace meta_hpp::detail template < typename T > uarg_base(type_list) = delete; - template < decay_value_kind T > - // NOLINTNEXTLINE(*-forwarding-reference-overload) - explicit uarg_base(T&&) - : uarg_base{type_list{}} {} - - template < decay_non_uvalue_kind T > + template < typename T, typename Tp = std::decay_t > + requires (!any_uvalue_kind) // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uarg_base(T&&) : uarg_base{type_list{}} {} @@ -111,14 +107,15 @@ namespace meta_hpp::detail ~uarg() override = default; - template < decay_value_kind T > + template < typename T, uvalue_kind Tp = std::decay_t > // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uarg(T&& v) : uarg_base{std::forward(v)} // NOLINTNEXTLINE(*-const-cast) , data_{const_cast(v.data())} {} - template < decay_non_uvalue_kind T > + template < typename T, typename Tp = std::decay_t > + requires (!any_uvalue_kind) // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uarg(T&& v) : uarg_base{std::forward(v)} diff --git a/headers/meta.hpp/meta_detail/value_utilities/uinst.hpp b/headers/meta.hpp/meta_detail/value_utilities/uinst.hpp index 5a917e1..15db579 100644 --- a/headers/meta.hpp/meta_detail/value_utilities/uinst.hpp +++ b/headers/meta.hpp/meta_detail/value_utilities/uinst.hpp @@ -36,12 +36,8 @@ namespace meta_hpp::detail template < typename T > uinst_base(type_list) = delete; - template < decay_value_kind T > - // NOLINTNEXTLINE(*-forwarding-reference-overload) - explicit uinst_base(T&&) - : uinst_base{type_list{}} {} - - template < decay_non_uvalue_kind T > + template < typename T, typename Tp = std::decay_t > + requires (!any_uvalue_kind) // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uinst_base(T&&) : uinst_base{type_list{}} {} @@ -116,14 +112,15 @@ namespace meta_hpp::detail ~uinst() override = default; - template < decay_value_kind T > + template < typename T, uvalue_kind Tp = std::decay_t > // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uinst(T&& v) : uinst_base{std::forward(v)} // NOLINTNEXTLINE(*-const-cast) , data_{const_cast(v.data())} {} - template < decay_non_uvalue_kind T > + template < typename T, typename Tp = std::decay_t > + requires (!any_uvalue_kind) // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uinst(T&& v) : uinst_base{std::forward(v)} diff --git a/headers/meta.hpp/meta_detail/value_utilities/utraits.hpp b/headers/meta.hpp/meta_detail/value_utilities/utraits.hpp index 5da8641..25c02c5 100644 --- a/headers/meta.hpp/meta_detail/value_utilities/utraits.hpp +++ b/headers/meta.hpp/meta_detail/value_utilities/utraits.hpp @@ -12,34 +12,14 @@ namespace meta_hpp::detail { - template < typename T > - inline constexpr bool is_uvalue_kind_v = - std::same_as || - std::same_as || - std::same_as || - std::same_as || - std::same_as; - - template < typename T > - concept uvalue_kind = is_uvalue_kind_v; - - template < typename T > - concept decay_uvalue_kind = uvalue_kind>; - - template < typename T > - concept decay_non_uvalue_kind = !decay_uvalue_kind; -} - -namespace meta_hpp::detail -{ - template < typename T > + template < typename T, typename Tp = std::decay_t > concept arg_lvalue_ref_kind = - (decay_non_uvalue_kind) && + (!any_uvalue_kind) && (std::is_lvalue_reference_v); - template < typename T > + template < typename T, typename Tp = std::decay_t > concept arg_rvalue_ref_kind = - (decay_non_uvalue_kind) && + (!any_uvalue_kind) && (!std::is_reference_v || std::is_rvalue_reference_v); } @@ -50,15 +30,15 @@ namespace meta_hpp::detail (std::is_class_v) || (std::is_reference_v && std::is_class_v>); - template < typename T > + template < typename T, typename Tp = std::decay_t > concept inst_class_lvalue_ref_kind = - (decay_non_uvalue_kind) && + (!any_uvalue_kind) && (std::is_lvalue_reference_v) && (std::is_class_v>>); - template < typename T > + template < typename T, typename Tp = std::decay_t > concept inst_class_rvalue_ref_kind = - (decay_non_uvalue_kind) && + (!any_uvalue_kind) && (!std::is_reference_v || std::is_rvalue_reference_v) && (std::is_class_v>>); } diff --git a/headers/meta.hpp/meta_states.hpp b/headers/meta.hpp/meta_states.hpp index dd764d6..3b72e84 100644 --- a/headers/meta.hpp/meta_states.hpp +++ b/headers/meta.hpp/meta_states.hpp @@ -17,83 +17,88 @@ namespace meta_hpp { namespace constructor_policy { - struct as_object final {}; - struct as_raw_pointer final {}; - struct as_shared_pointer final {}; + struct as_object_t final {}; + struct as_raw_pointer_t final {}; + struct as_shared_pointer_t final {}; + + inline constexpr as_object_t as_object{}; + inline constexpr as_raw_pointer_t as_raw_pointer{}; + inline constexpr as_shared_pointer_t as_shared_pointer{}; } namespace function_policy { - struct as_copy final {}; - struct discard_return final {}; - struct return_reference_as_pointer final {}; + struct as_copy_t final {}; + struct discard_return_t final {}; + struct return_reference_as_pointer_t final {}; + + inline constexpr as_copy_t as_copy{}; + inline constexpr discard_return_t discard_return{}; + inline constexpr return_reference_as_pointer_t return_reference_as_pointer{}; } namespace member_policy { - struct as_copy final {}; - struct as_pointer final {}; - struct as_reference_wrapper final {}; + struct as_copy_t final {}; + struct as_pointer_t final {}; + struct as_reference_wrapper_t final {}; + + inline constexpr as_copy_t as_copy{}; + inline constexpr as_pointer_t as_pointer{}; + inline constexpr as_reference_wrapper_t as_reference_wrapper{}; } namespace method_policy { - struct as_copy final {}; - struct discard_return final {}; - struct return_reference_as_pointer final {}; + struct as_copy_t final {}; + struct discard_return_t final {}; + struct return_reference_as_pointer_t final {}; + + inline constexpr as_copy_t as_copy{}; + inline constexpr discard_return_t discard_return{}; + inline constexpr return_reference_as_pointer_t return_reference_as_pointer{}; } namespace variable_policy { - struct as_copy final {}; - struct as_pointer final {}; - struct as_reference_wrapper final {}; + struct as_copy_t final {}; + struct as_pointer_t final {}; + struct as_reference_wrapper_t final {}; + + inline constexpr as_copy_t as_copy{}; + inline constexpr as_pointer_t as_pointer{}; + inline constexpr as_reference_wrapper_t as_reference_wrapper{}; } template < typename Policy > - inline constexpr bool is_constructor_policy_v = - std::same_as || - std::same_as || - std::same_as; + concept constructor_policy_kind = + std::same_as || + std::same_as || + std::same_as; template < typename Policy > - inline constexpr bool is_function_policy_v = - std::same_as || - std::same_as || - std::same_as; + concept function_policy_kind = + std::same_as || + std::same_as || + std::same_as; template < typename Policy > - inline constexpr bool is_member_policy_v = - std::same_as || - std::same_as || - std::same_as; + concept member_policy_kind = + std::same_as || + std::same_as || + std::same_as; template < typename Policy > - inline constexpr bool is_method_policy_v = - std::same_as || - std::same_as || - std::same_as; + concept method_policy_kind = + std::same_as || + std::same_as || + std::same_as; template < typename Policy > - inline constexpr bool is_variable_policy_v = - std::same_as || - std::same_as || - std::same_as; - - template < typename Policy > - concept constructor_policy_kind = is_constructor_policy_v; - - template < typename Policy > - concept function_policy_kind = is_function_policy_v; - - template < typename Policy > - concept member_policy_kind = is_member_policy_v; - - template < typename Policy > - concept method_policy_kind = is_method_policy_v; - - template < typename Policy > - concept variable_policy_kind = is_variable_policy_v; + concept variable_policy_kind = + std::same_as || + std::same_as || + std::same_as; } namespace meta_hpp diff --git a/headers/meta.hpp/meta_states/constructor.hpp b/headers/meta.hpp/meta_states/constructor.hpp index 8b9c84f..1cb8700 100644 --- a/headers/meta.hpp/meta_states/constructor.hpp +++ b/headers/meta.hpp/meta_states/constructor.hpp @@ -22,13 +22,13 @@ namespace meta_hpp::detail constexpr bool as_object = std::is_copy_constructible_v && - std::same_as; + std::same_as; constexpr bool as_raw_ptr = - std::same_as; + std::same_as; constexpr bool as_shared_ptr = - std::same_as; + std::same_as; static_assert(as_object || as_raw_ptr || as_shared_ptr); diff --git a/headers/meta.hpp/meta_states/function.hpp b/headers/meta.hpp/meta_states/function.hpp index eea4091..8dd33c4 100644 --- a/headers/meta.hpp/meta_states/function.hpp +++ b/headers/meta.hpp/meta_states/function.hpp @@ -22,15 +22,15 @@ namespace meta_hpp::detail constexpr bool as_copy = std::is_copy_constructible_v && - std::same_as; + std::same_as; constexpr bool as_void = std::is_void_v || - std::same_as; + std::same_as; constexpr bool ref_as_ptr = std::is_reference_v && - std::same_as; + std::same_as; static_assert(as_copy || as_void || ref_as_ptr); @@ -47,7 +47,7 @@ namespace meta_hpp::detail function( args[Is].cast>()...); return uvalue{}; - } else if constexpr ( std::same_as ) { + } else if constexpr ( std::same_as ) { std::ignore = function( args[Is].cast>()...); return uvalue{}; diff --git a/headers/meta.hpp/meta_states/member.hpp b/headers/meta.hpp/meta_states/member.hpp index 6e52ef2..3a2c20f 100644 --- a/headers/meta.hpp/meta_states/member.hpp +++ b/headers/meta.hpp/meta_states/member.hpp @@ -23,13 +23,13 @@ namespace meta_hpp::detail constexpr bool as_copy = std::is_copy_constructible_v && - std::same_as; + std::same_as; constexpr bool as_ptr = - std::same_as; + std::same_as; constexpr bool as_ref_wrap = - std::same_as; + std::same_as; static_assert(as_copy || as_ptr || as_ref_wrap); diff --git a/headers/meta.hpp/meta_states/method.hpp b/headers/meta.hpp/meta_states/method.hpp index 5a3c212..1cc31fb 100644 --- a/headers/meta.hpp/meta_states/method.hpp +++ b/headers/meta.hpp/meta_states/method.hpp @@ -24,15 +24,15 @@ namespace meta_hpp::detail constexpr bool as_copy = std::is_copy_constructible_v && - std::same_as; + std::same_as; constexpr bool as_void = std::is_void_v || - std::same_as; + std::same_as; constexpr bool ref_as_ptr = std::is_reference_v && - std::same_as; + std::same_as; static_assert(as_copy || as_void || ref_as_ptr); @@ -53,7 +53,7 @@ namespace meta_hpp::detail (inst.cast().*method)( args[Is].cast>()...); return uvalue{}; - } else if constexpr ( std::same_as ) { + } else if constexpr ( std::same_as ) { std::ignore = (inst.cast().*method)( args[Is].cast>()...); return uvalue{}; diff --git a/headers/meta.hpp/meta_states/variable.hpp b/headers/meta.hpp/meta_states/variable.hpp index 26b6b84..02a6980 100644 --- a/headers/meta.hpp/meta_states/variable.hpp +++ b/headers/meta.hpp/meta_states/variable.hpp @@ -21,13 +21,13 @@ namespace meta_hpp::detail constexpr bool as_copy = std::is_copy_constructible_v && - std::same_as; + std::same_as; constexpr bool as_ptr = - std::same_as; + std::same_as; constexpr bool as_ref_wrap = - std::same_as; + std::same_as; static_assert(as_copy || as_ptr || as_ref_wrap); diff --git a/headers/meta.hpp/meta_uvalue.hpp b/headers/meta.hpp/meta_uvalue.hpp index 7af0fd5..5eec950 100644 --- a/headers/meta.hpp/meta_uvalue.hpp +++ b/headers/meta.hpp/meta_uvalue.hpp @@ -12,16 +12,16 @@ namespace meta_hpp::detail { template < typename T > - inline constexpr bool is_value_kind_v = std::same_as; + concept uvalue_kind + = std::same_as; template < typename T > - concept value_kind = is_value_kind_v; - - template < typename T > - concept decay_value_kind = value_kind>; - - template < typename T > - concept decay_non_value_kind = !decay_value_kind; + concept any_uvalue_kind = + std::same_as || + std::same_as || + std::same_as || + std::same_as || + std::same_as; } namespace meta_hpp @@ -37,34 +37,37 @@ namespace meta_hpp uvalue& operator=(uvalue&& other) noexcept; uvalue& operator=(const uvalue& other); - template < detail::decay_non_value_kind T > - requires std::is_copy_constructible_v> - && (!detail::is_in_place_type_v>) + template < typename T, typename Tp = std::decay_t > + requires (!detail::any_uvalue_kind) + && (!detail::is_in_place_type_v) + && (std::is_copy_constructible_v) // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uvalue(T&& val); - template < detail::decay_non_value_kind T > - requires std::is_copy_constructible_v> + template < typename T, typename Tp = std::decay_t > + requires (!detail::any_uvalue_kind) + && (!detail::is_in_place_type_v) + && (std::is_copy_constructible_v) uvalue& operator=(T&& val); - template < typename T, typename... Args > - requires std::is_copy_constructible_v> - && std::is_constructible_v, Args...> + template < typename T, typename... Args, typename Tp = std::decay_t > + requires std::is_copy_constructible_v + && std::is_constructible_v explicit uvalue(std::in_place_type_t, Args&&... args); - template < typename T, typename U, typename... Args > - requires std::is_copy_constructible_v> - && std::is_constructible_v, std::initializer_list&, Args...> + template < typename T, typename U, typename... Args, typename Tp = std::decay_t > + requires std::is_copy_constructible_v + && std::is_constructible_v&, Args...> explicit uvalue(std::in_place_type_t, std::initializer_list ilist, Args&&... args); - template < typename T, typename... Args > - requires std::is_copy_constructible_v> - && std::is_constructible_v, Args...> + template < typename T, typename... Args, typename Tp = std::decay_t > + requires std::is_copy_constructible_v + && std::is_constructible_v std::decay_t& emplace(Args&&... args); - template < typename T, typename U, typename... Args > - requires std::is_copy_constructible_v> - && std::is_constructible_v, std::initializer_list&, Args...> + template < typename T, typename U, typename... Args, typename Tp = std::decay_t > + requires std::is_copy_constructible_v + && std::is_constructible_v&, Args...> std::decay_t& emplace(std::initializer_list ilist, Args&&... args); [[nodiscard]] bool is_valid() const noexcept; diff --git a/headers/meta.hpp/meta_uvalue/invoke.hpp b/headers/meta.hpp/meta_uvalue/invoke.hpp index 3dfae6b..812d9a6 100644 --- a/headers/meta.hpp/meta_uvalue/invoke.hpp +++ b/headers/meta.hpp/meta_uvalue/invoke.hpp @@ -25,9 +25,9 @@ namespace meta_hpp using namespace detail; if constexpr ( sizeof...(Args) > 0 ) { const std::array vargs{uarg{std::forward(args)}...}; - return raw_function_invoke(std::forward(function), vargs); + return raw_function_invoke(std::forward(function), vargs); } else { - return raw_function_invoke(std::forward(function), {}); + return raw_function_invoke(std::forward(function), {}); } } } @@ -43,7 +43,7 @@ namespace meta_hpp uvalue invoke(Member&& member, Instance&& instance) { using namespace detail; const uinst vinst{std::forward(instance)}; - return raw_member_getter(std::forward(member), vinst); + return raw_member_getter(std::forward(member), vinst); } } @@ -60,9 +60,9 @@ namespace meta_hpp const uinst vinst{std::forward(instance)}; if constexpr ( sizeof...(Args) > 0 ) { const std::array vargs{uarg{std::forward(args)}...}; - return raw_method_invoke(std::forward(method), vinst, vargs); + return raw_method_invoke(std::forward(method), vinst, vargs); } else { - return raw_method_invoke(std::forward(method), vinst, {}); + return raw_method_invoke(std::forward(method), vinst, {}); } } } diff --git a/headers/meta.hpp/meta_uvalue/uvalue.hpp b/headers/meta.hpp/meta_uvalue/uvalue.hpp index 3a705e9..071933e 100644 --- a/headers/meta.hpp/meta_uvalue/uvalue.hpp +++ b/headers/meta.hpp/meta_uvalue/uvalue.hpp @@ -255,46 +255,49 @@ namespace meta_hpp return *this; } - template < detail::decay_non_value_kind T > - requires std::is_copy_constructible_v> - && (!detail::is_in_place_type_v>) + template < typename T, typename Tp > + requires (!detail::any_uvalue_kind) + && (!detail::is_in_place_type_v) + && (std::is_copy_constructible_v) // NOLINTNEXTLINE(*-forwarding-reference-overload) uvalue::uvalue(T&& val) { vtable_t::construct(*this, std::forward(val)); } - template < detail::decay_non_value_kind T > - requires std::is_copy_constructible_v> + template < typename T, typename Tp > + requires (!detail::any_uvalue_kind) + && (!detail::is_in_place_type_v) + && (std::is_copy_constructible_v) uvalue& uvalue::operator=(T&& val) { uvalue{std::forward(val)}.swap(*this); return *this; } - template < typename T, typename... Args > - requires std::is_copy_constructible_v> - && std::is_constructible_v, Args...> + template < typename T, typename... Args, typename Tp > + requires std::is_copy_constructible_v + && std::is_constructible_v uvalue::uvalue(std::in_place_type_t, Args&&... args) { vtable_t::construct(*this, std::forward(args)...); } - template < typename T, typename U, typename... Args > - requires std::is_copy_constructible_v> - && std::is_constructible_v, std::initializer_list&, Args...> + template < typename T, typename U, typename... Args, typename Tp > + requires std::is_copy_constructible_v + && std::is_constructible_v&, Args...> uvalue::uvalue(std::in_place_type_t, std::initializer_list ilist, Args&&... args) { vtable_t::construct(*this, ilist, std::forward(args)...); } - template < typename T, typename... Args > - requires std::is_copy_constructible_v> - && std::is_constructible_v, Args...> + template < typename T, typename... Args, typename Tp > + requires std::is_copy_constructible_v + && std::is_constructible_v std::decay_t& uvalue::emplace(Args&&... args) { reset(); return vtable_t::construct(*this, std::forward(args)...); } - template < typename T, typename U, typename... Args > - requires std::is_copy_constructible_v> - && std::is_constructible_v, std::initializer_list&, Args...> + template < typename T, typename U, typename... Args, typename Tp > + requires std::is_copy_constructible_v + && std::is_constructible_v&, Args...> std::decay_t& uvalue::emplace(std::initializer_list ilist, Args&&... args) { reset(); return vtable_t::construct(*this, ilist, std::forward(args)...); @@ -510,7 +513,8 @@ namespace meta_hpp namespace meta_hpp { - template < detail::decay_non_value_kind T > + template < typename T, typename Tp = std::decay_t > + requires (!detail::uvalue_kind) [[nodiscard]] bool operator<(const uvalue& l, const T& r) { if ( !static_cast(l) ) { return true; @@ -522,7 +526,8 @@ namespace meta_hpp return (l_type < r_type) || (l_type == r_type && l.get_as() < r); } - template < detail::decay_non_value_kind T > + template < typename T, typename Tp = std::decay_t > + requires (!detail::uvalue_kind) [[nodiscard]] bool operator<(const T& l, const uvalue& r) { if ( !static_cast(r) ) { return false; @@ -537,7 +542,8 @@ namespace meta_hpp namespace meta_hpp { - template < detail::decay_non_value_kind T > + template < typename T, typename Tp = std::decay_t > + requires (!detail::uvalue_kind) [[nodiscard]] bool operator==(const uvalue& l, const T& r) { if ( !static_cast(l) ) { return false; @@ -549,7 +555,8 @@ namespace meta_hpp return l_type == r_type && l.get_as() == r; } - template < detail::decay_non_value_kind T > + template < typename T, typename Tp = std::decay_t > + requires (!detail::uvalue_kind) [[nodiscard]] bool operator==(const T& l, const uvalue& r) { if ( !static_cast(r) ) { return false; diff --git a/singles/headers/meta.hpp/meta_all.hpp b/singles/headers/meta.hpp/meta_all.hpp index e017f4d..d0de565 100644 --- a/singles/headers/meta.hpp/meta_all.hpp +++ b/singles/headers/meta.hpp/meta_all.hpp @@ -969,7 +969,7 @@ namespace meta_hpp namespace meta_hpp::detail { template < typename T > - inline constexpr bool is_type_family_v = + concept type_family = std::same_as || std::same_as || std::same_as || @@ -985,9 +985,6 @@ namespace meta_hpp::detail std::same_as || std::same_as; - template < typename T > - concept type_family = is_type_family_v; - template < type_family T > [[nodiscard]] auto type_access(const T& type) { return type.data_; @@ -2093,7 +2090,7 @@ namespace meta_hpp::detail namespace meta_hpp::detail { template < typename T > - inline constexpr bool is_index_family_v = + concept index_family = std::same_as || std::same_as || std::same_as || @@ -2103,9 +2100,6 @@ namespace meta_hpp::detail std::same_as || std::same_as || std::same_as; - - template < typename T > - concept index_family = is_index_family_v; } namespace meta_hpp @@ -2288,16 +2282,16 @@ namespace std namespace meta_hpp::detail { template < typename T > - inline constexpr bool is_value_kind_v = std::same_as; + concept uvalue_kind + = std::same_as; template < typename T > - concept value_kind = is_value_kind_v; - - template < typename T > - concept decay_value_kind = value_kind>; - - template < typename T > - concept decay_non_value_kind = !decay_value_kind; + concept any_uvalue_kind = + std::same_as || + std::same_as || + std::same_as || + std::same_as || + std::same_as; } namespace meta_hpp @@ -2313,34 +2307,37 @@ namespace meta_hpp uvalue& operator=(uvalue&& other) noexcept; uvalue& operator=(const uvalue& other); - template < detail::decay_non_value_kind T > - requires std::is_copy_constructible_v> - && (!detail::is_in_place_type_v>) + template < typename T, typename Tp = std::decay_t > + requires (!detail::any_uvalue_kind) + && (!detail::is_in_place_type_v) + && (std::is_copy_constructible_v) // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uvalue(T&& val); - template < detail::decay_non_value_kind T > - requires std::is_copy_constructible_v> + template < typename T, typename Tp = std::decay_t > + requires (!detail::any_uvalue_kind) + && (!detail::is_in_place_type_v) + && (std::is_copy_constructible_v) uvalue& operator=(T&& val); - template < typename T, typename... Args > - requires std::is_copy_constructible_v> - && std::is_constructible_v, Args...> + template < typename T, typename... Args, typename Tp = std::decay_t > + requires std::is_copy_constructible_v + && std::is_constructible_v explicit uvalue(std::in_place_type_t, Args&&... args); - template < typename T, typename U, typename... Args > - requires std::is_copy_constructible_v> - && std::is_constructible_v, std::initializer_list&, Args...> + template < typename T, typename U, typename... Args, typename Tp = std::decay_t > + requires std::is_copy_constructible_v + && std::is_constructible_v&, Args...> explicit uvalue(std::in_place_type_t, std::initializer_list ilist, Args&&... args); - template < typename T, typename... Args > - requires std::is_copy_constructible_v> - && std::is_constructible_v, Args...> + template < typename T, typename... Args, typename Tp = std::decay_t > + requires std::is_copy_constructible_v + && std::is_constructible_v std::decay_t& emplace(Args&&... args); - template < typename T, typename U, typename... Args > - requires std::is_copy_constructible_v> - && std::is_constructible_v, std::initializer_list&, Args...> + template < typename T, typename U, typename... Args, typename Tp = std::decay_t > + requires std::is_copy_constructible_v + && std::is_constructible_v&, Args...> std::decay_t& emplace(std::initializer_list ilist, Args&&... args); [[nodiscard]] bool is_valid() const noexcept; @@ -2406,7 +2403,7 @@ namespace meta_hpp namespace meta_hpp::detail { template < typename T > - inline constexpr bool is_state_family_v = + concept state_family = std::same_as || std::same_as || std::same_as || @@ -2417,9 +2414,6 @@ namespace meta_hpp::detail std::same_as || std::same_as; - template < typename T > - concept state_family = is_state_family_v; - template < state_family T > [[nodiscard]] auto state_access(const T& state) { return state.state_; @@ -2430,83 +2424,88 @@ namespace meta_hpp { namespace constructor_policy { - struct as_object final {}; - struct as_raw_pointer final {}; - struct as_shared_pointer final {}; + struct as_object_t final {}; + struct as_raw_pointer_t final {}; + struct as_shared_pointer_t final {}; + + inline constexpr as_object_t as_object{}; + inline constexpr as_raw_pointer_t as_raw_pointer{}; + inline constexpr as_shared_pointer_t as_shared_pointer{}; } namespace function_policy { - struct as_copy final {}; - struct discard_return final {}; - struct return_reference_as_pointer final {}; + struct as_copy_t final {}; + struct discard_return_t final {}; + struct return_reference_as_pointer_t final {}; + + inline constexpr as_copy_t as_copy{}; + inline constexpr discard_return_t discard_return{}; + inline constexpr return_reference_as_pointer_t return_reference_as_pointer{}; } namespace member_policy { - struct as_copy final {}; - struct as_pointer final {}; - struct as_reference_wrapper final {}; + struct as_copy_t final {}; + struct as_pointer_t final {}; + struct as_reference_wrapper_t final {}; + + inline constexpr as_copy_t as_copy{}; + inline constexpr as_pointer_t as_pointer{}; + inline constexpr as_reference_wrapper_t as_reference_wrapper{}; } namespace method_policy { - struct as_copy final {}; - struct discard_return final {}; - struct return_reference_as_pointer final {}; + struct as_copy_t final {}; + struct discard_return_t final {}; + struct return_reference_as_pointer_t final {}; + + inline constexpr as_copy_t as_copy{}; + inline constexpr discard_return_t discard_return{}; + inline constexpr return_reference_as_pointer_t return_reference_as_pointer{}; } namespace variable_policy { - struct as_copy final {}; - struct as_pointer final {}; - struct as_reference_wrapper final {}; + struct as_copy_t final {}; + struct as_pointer_t final {}; + struct as_reference_wrapper_t final {}; + + inline constexpr as_copy_t as_copy{}; + inline constexpr as_pointer_t as_pointer{}; + inline constexpr as_reference_wrapper_t as_reference_wrapper{}; } template < typename Policy > - inline constexpr bool is_constructor_policy_v = - std::same_as || - std::same_as || - std::same_as; + concept constructor_policy_kind = + std::same_as || + std::same_as || + std::same_as; template < typename Policy > - inline constexpr bool is_function_policy_v = - std::same_as || - std::same_as || - std::same_as; + concept function_policy_kind = + std::same_as || + std::same_as || + std::same_as; template < typename Policy > - inline constexpr bool is_member_policy_v = - std::same_as || - std::same_as || - std::same_as; + concept member_policy_kind = + std::same_as || + std::same_as || + std::same_as; template < typename Policy > - inline constexpr bool is_method_policy_v = - std::same_as || - std::same_as || - std::same_as; + concept method_policy_kind = + std::same_as || + std::same_as || + std::same_as; template < typename Policy > - inline constexpr bool is_variable_policy_v = - std::same_as || - std::same_as || - std::same_as; - - template < typename Policy > - concept constructor_policy_kind = is_constructor_policy_v; - - template < typename Policy > - concept function_policy_kind = is_function_policy_v; - - template < typename Policy > - concept member_policy_kind = is_member_policy_v; - - template < typename Policy > - concept method_policy_kind = is_method_policy_v; - - template < typename Policy > - concept variable_policy_kind = is_variable_policy_v; + concept variable_policy_kind = + std::same_as || + std::same_as || + std::same_as; } namespace meta_hpp @@ -3333,12 +3332,12 @@ namespace meta_hpp // constructor_ template < typename... Args - , constructor_policy_kind Policy = constructor_policy::as_object > + , constructor_policy_kind Policy = constructor_policy::as_object_t > class_bind& constructor_(Policy = Policy{}) requires detail::class_bind_constructor_kind; template < typename... Args - , constructor_policy_kind Policy = constructor_policy::as_object > + , constructor_policy_kind Policy = constructor_policy::as_object_t > class_bind& constructor_(constructor_opts opts, Policy = Policy{}) requires detail::class_bind_constructor_kind; @@ -3353,14 +3352,14 @@ namespace meta_hpp // function_ template < detail::function_kind Function - , function_policy_kind Policy = function_policy::as_copy > + , function_policy_kind Policy = function_policy::as_copy_t > class_bind& function_( std::string name, Function function, Policy = Policy{}); template < detail::function_kind Function - , function_policy_kind Policy = function_policy::as_copy > + , function_policy_kind Policy = function_policy::as_copy_t > class_bind& function_( std::string name, Function function, @@ -3368,7 +3367,7 @@ namespace meta_hpp Policy = Policy{}); template < detail::function_kind Function - , function_policy_kind Policy = function_policy::as_copy > + , function_policy_kind Policy = function_policy::as_copy_t > class_bind& function_( std::string name, Function function, @@ -3378,7 +3377,7 @@ namespace meta_hpp // member_ template < detail::member_kind Member - , member_policy_kind Policy = member_policy::as_copy > + , member_policy_kind Policy = member_policy::as_copy_t > class_bind& member_( std::string name, Member member, @@ -3386,7 +3385,7 @@ namespace meta_hpp requires detail::class_bind_member_kind; template < detail::member_kind Member - , member_policy_kind Policy = member_policy::as_copy > + , member_policy_kind Policy = member_policy::as_copy_t > class_bind& member_( std::string name, Member member, @@ -3397,7 +3396,7 @@ namespace meta_hpp // method_ template < detail::method_kind Method - , method_policy_kind Policy = method_policy::as_copy > + , method_policy_kind Policy = method_policy::as_copy_t > class_bind& method_( std::string name, Method method, @@ -3405,7 +3404,7 @@ namespace meta_hpp requires detail::class_bind_method_kind; template < detail::method_kind Method - , method_policy_kind Policy = method_policy::as_copy > + , method_policy_kind Policy = method_policy::as_copy_t > class_bind& method_( std::string name, Method method, @@ -3414,7 +3413,7 @@ namespace meta_hpp requires detail::class_bind_method_kind; template < detail::method_kind Method - , method_policy_kind Policy = method_policy::as_copy > + , method_policy_kind Policy = method_policy::as_copy_t > class_bind& method_( std::string name, Method method, @@ -3430,14 +3429,14 @@ namespace meta_hpp // variable_ template < detail::pointer_kind Pointer - , variable_policy_kind Policy = variable_policy::as_copy > + , variable_policy_kind Policy = variable_policy::as_copy_t > class_bind& variable_( std::string name, Pointer pointer, Policy = Policy{}); template < detail::pointer_kind Pointer - , variable_policy_kind Policy = variable_policy::as_copy > + , variable_policy_kind Policy = variable_policy::as_copy_t > class_bind& variable_( std::string name, Pointer pointer, @@ -3583,14 +3582,14 @@ namespace meta_hpp // function_ template < detail::function_kind Function - , function_policy_kind Policy = function_policy::as_copy > + , function_policy_kind Policy = function_policy::as_copy_t > scope_bind& function_( std::string name, Function function, Policy = Policy{}); template < detail::function_kind Function - , function_policy_kind Policy = function_policy::as_copy > + , function_policy_kind Policy = function_policy::as_copy_t > scope_bind& function_( std::string name, Function function, @@ -3598,7 +3597,7 @@ namespace meta_hpp Policy = Policy{}); template < detail::function_kind Function - , function_policy_kind Policy = function_policy::as_copy > + , function_policy_kind Policy = function_policy::as_copy_t > scope_bind& function_( std::string name, Function function, @@ -3613,14 +3612,14 @@ namespace meta_hpp // variable_ template < detail::pointer_kind Pointer - , variable_policy_kind Policy = variable_policy::as_copy > + , variable_policy_kind Policy = variable_policy::as_copy_t > scope_bind& variable_( std::string name, Pointer pointer, Policy = Policy{}); template < detail::pointer_kind Pointer - , variable_policy_kind Policy = variable_policy::as_copy > + , variable_policy_kind Policy = variable_policy::as_copy_t > scope_bind& variable_( std::string name, Pointer pointer, @@ -4746,34 +4745,14 @@ namespace meta_hpp namespace meta_hpp::detail { - template < typename T > - inline constexpr bool is_uvalue_kind_v = - std::same_as || - std::same_as || - std::same_as || - std::same_as || - std::same_as; - - template < typename T > - concept uvalue_kind = is_uvalue_kind_v; - - template < typename T > - concept decay_uvalue_kind = uvalue_kind>; - - template < typename T > - concept decay_non_uvalue_kind = !decay_uvalue_kind; -} - -namespace meta_hpp::detail -{ - template < typename T > + template < typename T, typename Tp = std::decay_t > concept arg_lvalue_ref_kind = - (decay_non_uvalue_kind) && + (!any_uvalue_kind) && (std::is_lvalue_reference_v); - template < typename T > + template < typename T, typename Tp = std::decay_t > concept arg_rvalue_ref_kind = - (decay_non_uvalue_kind) && + (!any_uvalue_kind) && (!std::is_reference_v || std::is_rvalue_reference_v); } @@ -4784,15 +4763,15 @@ namespace meta_hpp::detail (std::is_class_v) || (std::is_reference_v && std::is_class_v>); - template < typename T > + template < typename T, typename Tp = std::decay_t > concept inst_class_lvalue_ref_kind = - (decay_non_uvalue_kind) && + (!any_uvalue_kind) && (std::is_lvalue_reference_v) && (std::is_class_v>>); - template < typename T > + template < typename T, typename Tp = std::decay_t > concept inst_class_rvalue_ref_kind = - (decay_non_uvalue_kind) && + (!any_uvalue_kind) && (!std::is_reference_v || std::is_rvalue_reference_v) && (std::is_class_v>>); } @@ -4912,12 +4891,8 @@ namespace meta_hpp::detail template < typename T > uarg_base(type_list) = delete; - template < decay_value_kind T > - // NOLINTNEXTLINE(*-forwarding-reference-overload) - explicit uarg_base(T&&) - : uarg_base{type_list{}} {} - - template < decay_non_uvalue_kind T > + template < typename T, typename Tp = std::decay_t > + requires (!any_uvalue_kind) // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uarg_base(T&&) : uarg_base{type_list{}} {} @@ -4987,14 +4962,15 @@ namespace meta_hpp::detail ~uarg() override = default; - template < decay_value_kind T > + template < typename T, uvalue_kind Tp = std::decay_t > // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uarg(T&& v) : uarg_base{std::forward(v)} // NOLINTNEXTLINE(*-const-cast) , data_{const_cast(v.data())} {} - template < decay_non_uvalue_kind T > + template < typename T, typename Tp = std::decay_t > + requires (!any_uvalue_kind) // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uarg(T&& v) : uarg_base{std::forward(v)} @@ -5242,13 +5218,13 @@ namespace meta_hpp::detail constexpr bool as_object = std::is_copy_constructible_v && - std::same_as; + std::same_as; constexpr bool as_raw_ptr = - std::same_as; + std::same_as; constexpr bool as_shared_ptr = - std::same_as; + std::same_as; static_assert(as_object || as_raw_ptr || as_shared_ptr); @@ -5781,15 +5757,15 @@ namespace meta_hpp::detail constexpr bool as_copy = std::is_copy_constructible_v && - std::same_as; + std::same_as; constexpr bool as_void = std::is_void_v || - std::same_as; + std::same_as; constexpr bool ref_as_ptr = std::is_reference_v && - std::same_as; + std::same_as; static_assert(as_copy || as_void || ref_as_ptr); @@ -5806,7 +5782,7 @@ namespace meta_hpp::detail function( args[Is].cast>()...); return uvalue{}; - } else if constexpr ( std::same_as ) { + } else if constexpr ( std::same_as ) { std::ignore = function( args[Is].cast>()...); return uvalue{}; @@ -6038,12 +6014,8 @@ namespace meta_hpp::detail template < typename T > uinst_base(type_list) = delete; - template < decay_value_kind T > - // NOLINTNEXTLINE(*-forwarding-reference-overload) - explicit uinst_base(T&&) - : uinst_base{type_list{}} {} - - template < decay_non_uvalue_kind T > + template < typename T, typename Tp = std::decay_t > + requires (!any_uvalue_kind) // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uinst_base(T&&) : uinst_base{type_list{}} {} @@ -6118,14 +6090,15 @@ namespace meta_hpp::detail ~uinst() override = default; - template < decay_value_kind T > + template < typename T, uvalue_kind Tp = std::decay_t > // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uinst(T&& v) : uinst_base{std::forward(v)} // NOLINTNEXTLINE(*-const-cast) , data_{const_cast(v.data())} {} - template < decay_non_uvalue_kind T > + template < typename T, typename Tp = std::decay_t > + requires (!any_uvalue_kind) // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uinst(T&& v) : uinst_base{std::forward(v)} @@ -6258,13 +6231,13 @@ namespace meta_hpp::detail constexpr bool as_copy = std::is_copy_constructible_v && - std::same_as; + std::same_as; constexpr bool as_ptr = - std::same_as; + std::same_as; constexpr bool as_ref_wrap = - std::same_as; + std::same_as; static_assert(as_copy || as_ptr || as_ref_wrap); @@ -6555,15 +6528,15 @@ namespace meta_hpp::detail constexpr bool as_copy = std::is_copy_constructible_v && - std::same_as; + std::same_as; constexpr bool as_void = std::is_void_v || - std::same_as; + std::same_as; constexpr bool ref_as_ptr = std::is_reference_v && - std::same_as; + std::same_as; static_assert(as_copy || as_void || ref_as_ptr); @@ -6584,7 +6557,7 @@ namespace meta_hpp::detail (inst.cast().*method)( args[Is].cast>()...); return uvalue{}; - } else if constexpr ( std::same_as ) { + } else if constexpr ( std::same_as ) { std::ignore = (inst.cast().*method)( args[Is].cast>()...); return uvalue{}; @@ -6804,13 +6777,13 @@ namespace meta_hpp::detail constexpr bool as_copy = std::is_copy_constructible_v && - std::same_as; + std::same_as; constexpr bool as_ptr = - std::same_as; + std::same_as; constexpr bool as_ref_wrap = - std::same_as; + std::same_as; static_assert(as_copy || as_ptr || as_ref_wrap); @@ -7833,9 +7806,9 @@ namespace meta_hpp using namespace detail; if constexpr ( sizeof...(Args) > 0 ) { const std::array vargs{uarg{std::forward(args)}...}; - return raw_function_invoke(std::forward(function), vargs); + return raw_function_invoke(std::forward(function), vargs); } else { - return raw_function_invoke(std::forward(function), {}); + return raw_function_invoke(std::forward(function), {}); } } } @@ -7851,7 +7824,7 @@ namespace meta_hpp uvalue invoke(Member&& member, Instance&& instance) { using namespace detail; const uinst vinst{std::forward(instance)}; - return raw_member_getter(std::forward(member), vinst); + return raw_member_getter(std::forward(member), vinst); } } @@ -7868,9 +7841,9 @@ namespace meta_hpp const uinst vinst{std::forward(instance)}; if constexpr ( sizeof...(Args) > 0 ) { const std::array vargs{uarg{std::forward(args)}...}; - return raw_method_invoke(std::forward(method), vinst, vargs); + return raw_method_invoke(std::forward(method), vinst, vargs); } else { - return raw_method_invoke(std::forward(method), vinst, {}); + return raw_method_invoke(std::forward(method), vinst, {}); } } } @@ -8376,46 +8349,49 @@ namespace meta_hpp return *this; } - template < detail::decay_non_value_kind T > - requires std::is_copy_constructible_v> - && (!detail::is_in_place_type_v>) + template < typename T, typename Tp > + requires (!detail::any_uvalue_kind) + && (!detail::is_in_place_type_v) + && (std::is_copy_constructible_v) // NOLINTNEXTLINE(*-forwarding-reference-overload) uvalue::uvalue(T&& val) { vtable_t::construct(*this, std::forward(val)); } - template < detail::decay_non_value_kind T > - requires std::is_copy_constructible_v> + template < typename T, typename Tp > + requires (!detail::any_uvalue_kind) + && (!detail::is_in_place_type_v) + && (std::is_copy_constructible_v) uvalue& uvalue::operator=(T&& val) { uvalue{std::forward(val)}.swap(*this); return *this; } - template < typename T, typename... Args > - requires std::is_copy_constructible_v> - && std::is_constructible_v, Args...> + template < typename T, typename... Args, typename Tp > + requires std::is_copy_constructible_v + && std::is_constructible_v uvalue::uvalue(std::in_place_type_t, Args&&... args) { vtable_t::construct(*this, std::forward(args)...); } - template < typename T, typename U, typename... Args > - requires std::is_copy_constructible_v> - && std::is_constructible_v, std::initializer_list&, Args...> + template < typename T, typename U, typename... Args, typename Tp > + requires std::is_copy_constructible_v + && std::is_constructible_v&, Args...> uvalue::uvalue(std::in_place_type_t, std::initializer_list ilist, Args&&... args) { vtable_t::construct(*this, ilist, std::forward(args)...); } - template < typename T, typename... Args > - requires std::is_copy_constructible_v> - && std::is_constructible_v, Args...> + template < typename T, typename... Args, typename Tp > + requires std::is_copy_constructible_v + && std::is_constructible_v std::decay_t& uvalue::emplace(Args&&... args) { reset(); return vtable_t::construct(*this, std::forward(args)...); } - template < typename T, typename U, typename... Args > - requires std::is_copy_constructible_v> - && std::is_constructible_v, std::initializer_list&, Args...> + template < typename T, typename U, typename... Args, typename Tp > + requires std::is_copy_constructible_v + && std::is_constructible_v&, Args...> std::decay_t& uvalue::emplace(std::initializer_list ilist, Args&&... args) { reset(); return vtable_t::construct(*this, ilist, std::forward(args)...); @@ -8631,7 +8607,8 @@ namespace meta_hpp namespace meta_hpp { - template < detail::decay_non_value_kind T > + template < typename T, typename Tp = std::decay_t > + requires (!detail::uvalue_kind) [[nodiscard]] bool operator<(const uvalue& l, const T& r) { if ( !static_cast(l) ) { return true; @@ -8643,7 +8620,8 @@ namespace meta_hpp return (l_type < r_type) || (l_type == r_type && l.get_as() < r); } - template < detail::decay_non_value_kind T > + template < typename T, typename Tp = std::decay_t > + requires (!detail::uvalue_kind) [[nodiscard]] bool operator<(const T& l, const uvalue& r) { if ( !static_cast(r) ) { return false; @@ -8658,7 +8636,8 @@ namespace meta_hpp namespace meta_hpp { - template < detail::decay_non_value_kind T > + template < typename T, typename Tp = std::decay_t > + requires (!detail::uvalue_kind) [[nodiscard]] bool operator==(const uvalue& l, const T& r) { if ( !static_cast(l) ) { return false; @@ -8670,7 +8649,8 @@ namespace meta_hpp return l_type == r_type && l.get_as() == r; } - template < detail::decay_non_value_kind T > + template < typename T, typename Tp = std::decay_t > + requires (!detail::uvalue_kind) [[nodiscard]] bool operator==(const T& l, const uvalue& r) { if ( !static_cast(r) ) { return false; diff --git a/untests/meta_states/ctor_tests.cpp b/untests/meta_states/ctor_tests.cpp index 201c6a2..23ed537 100644 --- a/untests/meta_states/ctor_tests.cpp +++ b/untests/meta_states/ctor_tests.cpp @@ -69,11 +69,11 @@ namespace TEST_CASE("meta/meta_states/ctor/noncopyable") { namespace meta = meta_hpp; - using clazz_t = clazz_noncopyable; + using clazz_t = clazz_noncopyable; meta::class_() - .constructor_(meta::constructor_policy::as_raw_pointer{}) - .constructor_(meta::constructor_policy::as_raw_pointer{}); + .constructor_(meta::constructor_policy::as_raw_pointer) + .constructor_(meta::constructor_policy::as_raw_pointer); clazz_t::constructor_counter = 0; clazz_t::destructor_counter = 0; @@ -124,12 +124,12 @@ TEST_CASE("meta/meta_states/ctor/noncopyable") { TEST_CASE("meta/meta_states/ctor/as_object") { namespace meta = meta_hpp; - using clazz_t = clazz; + using clazz_t = clazz; meta::class_() - .constructor_(meta::constructor_policy::as_object{}) - .constructor_(meta::constructor_policy::as_object{}) - .constructor_(meta::constructor_policy::as_object{}); + .constructor_(meta::constructor_policy::as_object) + .constructor_(meta::constructor_policy::as_object) + .constructor_(meta::constructor_policy::as_object); clazz_t::constructor_counter = 0; clazz_t::destructor_counter = 0; @@ -254,12 +254,12 @@ TEST_CASE("meta/meta_states/ctor/as_object") { TEST_CASE("meta/meta_states/ctor/as_raw_pointer") { namespace meta = meta_hpp; - using clazz_t = clazz; + using clazz_t = clazz; meta::class_() - .constructor_(meta::constructor_policy::as_raw_pointer{}) - .constructor_(meta::constructor_policy::as_raw_pointer{}) - .constructor_(meta::constructor_policy::as_raw_pointer{}); + .constructor_(meta::constructor_policy::as_raw_pointer) + .constructor_(meta::constructor_policy::as_raw_pointer) + .constructor_(meta::constructor_policy::as_raw_pointer); clazz_t::constructor_counter = 0; clazz_t::destructor_counter = 0; @@ -329,12 +329,12 @@ TEST_CASE("meta/meta_states/ctor/as_raw_pointer") { TEST_CASE("meta/meta_states/ctor/as_shared_pointer") { namespace meta = meta_hpp; - using clazz_t = clazz; + using clazz_t = clazz; meta::class_() - .constructor_(meta::constructor_policy::as_shared_pointer{}) - .constructor_(meta::constructor_policy::as_shared_pointer{}) - .constructor_(meta::constructor_policy::as_shared_pointer{}); + .constructor_(meta::constructor_policy::as_shared_pointer) + .constructor_(meta::constructor_policy::as_shared_pointer) + .constructor_(meta::constructor_policy::as_shared_pointer); clazz_t::constructor_counter = 0; clazz_t::destructor_counter = 0; diff --git a/untests/meta_states/member_tests.cpp b/untests/meta_states/member_tests.cpp index 4aee00c..8ea8262 100644 --- a/untests/meta_states/member_tests.cpp +++ b/untests/meta_states/member_tests.cpp @@ -24,8 +24,8 @@ TEST_CASE("meta/meta_states/member") { .member_("int_member", &clazz_1::int_member) .member_("const_int_member", &clazz_1::const_int_member) // .member_("unique_int_member", &clazz_1::unique_int_member) - .member_("unique_int_member_as_ptr", &clazz_1::unique_int_member, meta::member_policy::as_pointer{}) - .member_("unique_int_member_as_ref", &clazz_1::unique_int_member, meta::member_policy::as_reference_wrapper{}); + .member_("unique_int_member_as_ptr", &clazz_1::unique_int_member, meta::member_policy::as_pointer) + .member_("unique_int_member_as_ref", &clazz_1::unique_int_member, meta::member_policy::as_reference_wrapper); const meta::class_type clazz_1_type = meta::resolve_type(); REQUIRE(clazz_1_type); diff --git a/untests/meta_states/variable_tests.cpp b/untests/meta_states/variable_tests.cpp index f98b37c..7727e56 100644 --- a/untests/meta_states/variable_tests.cpp +++ b/untests/meta_states/variable_tests.cpp @@ -39,12 +39,12 @@ TEST_CASE("meta/meta_states/variable") { .variable_("const_ref_int_variable", &clazz_1::const_ref_int_variable) // .variable_("unique_int_variable", &clazz_1::unique_int_variable) - .variable_("unique_int_variable_as_ptr", &clazz_1::unique_int_variable, meta::variable_policy::as_pointer{}) - .variable_("unique_int_variable_as_ref", &clazz_1::unique_int_variable, meta::variable_policy::as_reference_wrapper{}) + .variable_("unique_int_variable_as_ptr", &clazz_1::unique_int_variable, meta::variable_policy::as_pointer) + .variable_("unique_int_variable_as_ref", &clazz_1::unique_int_variable, meta::variable_policy::as_reference_wrapper) // .variable_("const_unique_int_variable", &clazz_1::const_unique_int_variable) - .variable_("const_unique_int_variable_as_ptr", &clazz_1::const_unique_int_variable, meta::variable_policy::as_pointer{}) - .variable_("const_unique_int_variable_as_ref", &clazz_1::const_unique_int_variable, meta::variable_policy::as_reference_wrapper{}); + .variable_("const_unique_int_variable_as_ptr", &clazz_1::const_unique_int_variable, meta::variable_policy::as_pointer) + .variable_("const_unique_int_variable_as_ref", &clazz_1::const_unique_int_variable, meta::variable_policy::as_reference_wrapper); const meta::class_type clazz_1_type = meta::resolve_type(); REQUIRE(clazz_1_type); diff --git a/untests/meta_utilities/arg_tests.cpp b/untests/meta_utilities/arg_tests.cpp index b016d96..1dee57a 100644 --- a/untests/meta_utilities/arg_tests.cpp +++ b/untests/meta_utilities/arg_tests.cpp @@ -70,7 +70,7 @@ namespace {\ using namespace meta::detail;\ auto function_ptr = meta::select_overload(&FName);\ - meta::function f_state{function_state::make("", function_ptr, {})};\ + meta::function f_state{function_state::make("", function_ptr, {})};\ \ if ( std::is_invocable_v ) {\ CHECK(uarg{FromValue}.can_cast_to());\ @@ -94,7 +94,7 @@ namespace {\ using namespace meta::detail;\ auto function_ptr = meta::select_overload(&FName);\ - meta::function f_state{function_state::make("", function_ptr, {})};\ + meta::function f_state{function_state::make("", function_ptr, {})};\ \ if ( std::is_invocable_v ) {\ CHECK(f_state.is_invocable_with());\ diff --git a/untests/meta_utilities/inst_tests.cpp b/untests/meta_utilities/inst_tests.cpp index 6394a62..fe9dccb 100644 --- a/untests/meta_utilities/inst_tests.cpp +++ b/untests/meta_utilities/inst_tests.cpp @@ -30,7 +30,7 @@ namespace {\ using namespace meta::detail;\ auto method_ptr = meta::select_overload(&clazz::FName);\ - meta::method m_state{method_state::make("", method_ptr, {})};\ + meta::method m_state{method_state::make("", method_ptr, {})};\ \ if ( std::is_invocable_v ) {\ CHECK(uinst{Inst}.can_cast_to());\ @@ -54,7 +54,7 @@ namespace {\ using namespace meta::detail;\ auto method_ptr = meta::select_overload(&clazz::FName);\ - meta::method m_state{method_state::make("", method_ptr, {})};\ + meta::method m_state{method_state::make("", method_ptr, {})};\ \ if ( std::is_invocable_v ) {\ CHECK(m_state.is_invocable_with());\