diff --git a/include/embed/embed_function.hpp b/include/embed/embed_function.hpp index a16294b..9be831a 100644 --- a/include/embed/embed_function.hpp +++ b/include/embed/embed_function.hpp @@ -1086,7 +1086,7 @@ inline namespace fn_traits { // Check the functor is callable with given arguments. // [func.wrap.move.ctor]/1 template - struct is_callable_from { + struct is_callable_from_impl { using unwrap_sig = unwrap_signature; using ret = typename unwrap_sig::ret; using args_pack = typename unwrap_sig::args; @@ -1549,22 +1549,18 @@ inline namespace fn_traits { #endif // . - template ::pure_sig> struct is_invocable_using_impl; template - struct is_invocable_using_impl, Ret(Args...)> { - using type = conditional_t< + struct is_invocable_using_impl, Ret(Args...)> + : conditional_t< unwrap_signature::isNoexcept, is_nothrow_invocable_r, is_invocable_r - >; - }; - - // [func.wrap.ref.ctor]/1 is-invokable-using - template - using is_invocable_using_t = - typename is_invocable_using_impl>::type; + > + {}; template struct is_constant_wrapper : std::false_type {}; @@ -2695,6 +2691,17 @@ namespace crtp_mixins { // `true` if self is copyable. static constexpr bool internal_is_copyable = Config::isCopyable || Config::isView; + // [func.wrap.move.ctor]/1 is-callable-from + template + using is_callable_from = is_callable_from_impl; + + // [func.wrap.ref.ctor]/1 is-invocable-using + template + using is_invocable_using = is_invocable_using_impl>; + + template + using add_cv_like_sig_t = typename unwrap_signature::template add_cv_like; + public: // The return type. @@ -2807,7 +2814,7 @@ namespace crtp_mixins { (!fn_can_convert::value) && (!is_self::value) && (!is_in_place_type>::value) - && is_callable_from::value + && is_callable_from::value && (!Config::isView) ) function(Functor&& functor) noexcept(is_nothrow_construct_from_functor::value) { @@ -2829,7 +2836,7 @@ namespace crtp_mixins { EMBED_DETAIL_TEMPLATE_BEGIN(typename Func) EMBED_DETAIL_REQUIRES_END( std::is_function::value - && is_invocable_using_t::value + && is_invocable_using::value && Config::isView ) function(Func* function_ptr) noexcept { @@ -2850,10 +2857,10 @@ namespace crtp_mixins { /// @note Used for function reference only. (NON-OWNING) EMBED_DETAIL_TEMPLATE_BEGIN(typename Functor, typename Tp = remove_reference_t, - typename Tp_cv = typename unwrap_signature::template add_cv_like) + typename Tp_cv = add_cv_like_sig_t) EMBED_DETAIL_REQUIRES_END( (!is_self::value) - && is_invocable_using_t::value + && is_invocable_using::value && (!std::is_member_pointer::value) && (!fn_can_convert::value) && Config::isView @@ -2875,7 +2882,7 @@ namespace crtp_mixins { EMBED_DETAIL_TEMPLATE_BEGIN(typename Fn, typename... CArgs) EMBED_DETAIL_REQUIRES_END( std::is_constructible::value - && is_callable_from::value + && is_callable_from::value && (!Config::isView) ) explicit function(std::in_place_type_t, CArgs&&... args) noexcept(std::is_nothrow_constructible::value) { @@ -2895,7 +2902,7 @@ namespace crtp_mixins { EMBED_DETAIL_TEMPLATE_BEGIN(typename Fn, typename U, typename... CArgs) EMBED_DETAIL_REQUIRES_END( std::is_constructible&, CArgs...>::value - && is_callable_from::value + && is_callable_from::value && (!Config::isView) ) explicit function(std::in_place_type_t, std::initializer_list il, CArgs&&... args) noexcept(std::is_nothrow_constructible::value) { @@ -2917,7 +2924,7 @@ namespace crtp_mixins { // Create function reference with given `std::constant_wrapper` param. template - requires is_invocable_using_t::value + requires is_invocable_using::value && Config::isView constexpr function(std::constant_wrapper) noexcept : MemberVariableBase(nullptr) { @@ -2933,8 +2940,7 @@ namespace crtp_mixins { // Create function reference with given `std::constant_wrapper` and object params. template > requires (!std::is_rvalue_reference_v) - && is_invocable_using_t::template add_cv_like&>::value + && is_invocable_using&>::value && Config::isView constexpr function(std::constant_wrapper, Up&& obj) noexcept : MemberVariableBase(nullptr) { @@ -2948,11 +2954,9 @@ namespace crtp_mixins { } // Create function reference with given `std::constant_wrapper` and pointer params. - template ::template add_cv_like - > + template > requires std::is_convertible_v - && is_invocable_using_t::value + && is_invocable_using::value && Config::isView constexpr function(std::constant_wrapper, Tp* obj) noexcept : MemberVariableBase(nullptr) {