diff --git a/include/eve/traits/invoke/decorator.hpp b/include/eve/traits/invoke/decorator.hpp index 1e06b9cffd..e3511cc905 100644 --- a/include/eve/traits/invoke/decorator.hpp +++ b/include/eve/traits/invoke/decorator.hpp @@ -55,15 +55,18 @@ namespace eve struct decorators : Settings { template - constexpr explicit decorators(Options && ... options) : Settings(EVE_FWD(options) ...) {} + constexpr EVE_FORCEINLINE explicit decorators(Options && ... options) : Settings(EVE_FWD(options) ...) {} - constexpr decorators(Settings const& options) : Settings(options) {} + template + constexpr EVE_FORCEINLINE decorators(rbr::settings const& options) : Settings(options) {} }; - /// Deduction guide for eve::decorators template decorators(Options&& ... options) -> decorators; + template + decorators(rbr::settings const&) -> decorators>; + //================================================================================================ //! @struct support_options //! @brief Make an eve::callable responsive to decorators and masks @@ -88,7 +91,7 @@ namespace eve template EVE_FORCEINLINE auto operator[](Options&& o) const { - auto new_opts = rbr::merge(rbr::settings{o}, opts); + auto new_opts = decorators{rbr::merge(rbr::settings{o}, opts)}; return fn{new_opts}; } @@ -106,9 +109,9 @@ namespace eve template EVE_FORCEINLINE auto operator()(Args&&... x) const - -> tag_invoke_result, Args&&...> + -> tag_invoke_result { - return eve::tag_invoke(Tag{}, decorators{opts}, EVE_FWD(x)...); + return eve::tag_invoke(Tag{}, opts, EVE_FWD(x)...); } template @@ -120,18 +123,11 @@ namespace eve Settings opts; }; - //! @brief Modify the semantic of current eve::callable via a bundle of decorators or masks - template - EVE_FORCEINLINE auto operator[](Settings const& s) const - { - return fn>{decorators{s}}; - } - //! @brief Modify the semantic of current eve::callable by a decorator template EVE_FORCEINLINE auto operator[](Options const& o) const { - return (*this)[decorators{o}]; + return fn{decorators{o}}; } //! @brief Modify the semantic of current eve::callable by a mask @@ -163,10 +159,12 @@ namespace eve namespace eve::tags { template - constexpr auto tag_invoke(deferred_callable auto tag, auto arch, decorators opts, auto... x) - noexcept(noexcept(tag.deferred_call(arch, opts, x...))) - -> decltype(tag.deferred_call(arch, opts, x...)) + EVE_FORCEINLINE constexpr auto tag_invoke ( deferred_callable auto tag, auto arch + , decorators opts, auto&&... x + ) + noexcept(noexcept(tag.deferred_call(arch, opts, EVE_FWD(x)...))) + -> decltype(tag.deferred_call(arch, opts, EVE_FWD(x)...)) { - return tag.deferred_call(arch, opts, x...); + return tag.deferred_call(arch, opts, EVE_FWD(x)...); } } diff --git a/include/eve/traits/invoke/protocol.hpp b/include/eve/traits/invoke/protocol.hpp index 02e6f0e2bb..ff03392d96 100644 --- a/include/eve/traits/invoke/protocol.hpp +++ b/include/eve/traits/invoke/protocol.hpp @@ -7,7 +7,7 @@ //==================================================================================================== #pragma once -#include "eve/detail/raberu.hpp" +#include #include #include @@ -30,7 +30,9 @@ namespace eve //================================================================================================== template struct unsupported_call -{}; +{ + constexpr operator bool() const noexcept { return false; } +}; //! @brief Tag type for elementwise @callable properties struct elementwise @@ -132,18 +134,22 @@ std::ostream& operator<<(std::ostream& os, Tag const&) //================================================================================================== namespace eve::tags { - constexpr auto tag_invoke(deferred_callable auto tag, auto arch, auto... x) - noexcept(noexcept(tag.deferred_call(arch, x...))) -> decltype(tag.deferred_call(arch, x...)) + template + EVE_FORCEINLINE constexpr auto tag_invoke(Tag, auto arch, auto&&... x) + noexcept(noexcept(Tag::deferred_call(arch, EVE_FWD(x)...))) + -> decltype(Tag::deferred_call(arch, EVE_FWD(x)...)) { - return tag.deferred_call(arch, x...); + return Tag::deferred_call(arch, EVE_FWD(x)...); } } #define EVE_DEFERRED_INVOKE() \ -constexpr auto tag_invoke(eve::deferred_callable auto tag, auto arch, auto... x) \ -noexcept(noexcept(tag.deferred_call(arch, x...))) -> decltype(tag.deferred_call(arch, x...)) \ +template \ +EVE_FORCEINLINE constexpr auto tag_invoke(Tag, auto arch, auto&&... x) \ +noexcept(noexcept(Tag::deferred_call(arch, EVE_FWD(x)...))) \ +-> decltype(Tag::deferred_call(arch, EVE_FWD(x)...)) \ { \ - return tag.deferred_call(arch, x...); \ + return Tag::deferred_call(arch, EVE_FWD(x)...); \ } \ /**/ @@ -188,7 +194,7 @@ namespace eve::detail // General macro taking the deferred namespace NS and the function NAME //================================================================================================== #define EVE_DEFERS_CALLABLE_FROM(NS,NAME) \ -static auto deferred_call(auto arch, auto&&...args) noexcept \ +static EVE_FORCEINLINE auto deferred_call(auto arch, auto&&...args) noexcept \ -> decltype(NAME(NS::adl_delay, arch, EVE_FWD(args)...)) \ { \ return NAME(NS::adl_delay, arch, EVE_FWD(args)...); \