diff --git a/include/utempl/loopholes/core.hpp b/include/utempl/loopholes/core.hpp index 953a87c..84a37c8 100644 --- a/include/utempl/loopholes/core.hpp +++ b/include/utempl/loopholes/core.hpp @@ -1,3 +1,4 @@ +#include #pragma once namespace utempl::loopholes { @@ -12,8 +13,18 @@ struct Injector { }; -template -concept Injected = requires{Magic(Getter{});}; +template +struct InjectedImpl { + static constexpr bool value = false; +}; +template +struct InjectedImpl{}))>, Ts...> { + static constexpr bool value = true; +}; + +template +concept Injected = InjectedImpl::value; + diff --git a/include/utempl/loopholes/counter.hpp b/include/utempl/loopholes/counter.hpp index a1ca9f5..dd6a7be 100644 --- a/include/utempl/loopholes/counter.hpp +++ b/include/utempl/loopholes/counter.hpp @@ -7,15 +7,15 @@ namespace utempl::loopholes { namespace impl { template -struct TagWithTalue {}; +struct TagWithValue {}; -template {}>{}> +template {}>{}> constexpr auto Counter(...) { return I; }; template -consteval auto Counter(std::size_t arg) requires Injected{}, Ts...> { +consteval auto Counter(std::size_t arg) requires Injected{}, Ts...> { return Counter(arg); }; } // namespace impl; @@ -24,12 +24,14 @@ consteval auto Counter(std::size_t arg) requires Injected{} template < typename Tag, typename... Ts, - std::size_t R = impl::Counter<0, Tag, Ts...>(std::size_t{}) - 1 + std::size_t R = impl::Counter<0, Tag, Ts...>(std::size_t{}) +#if defined __clang__ + - 1 +#endif > consteval auto Counter(auto...) -> std::size_t { return R; }; - } // namespace utempl::loopholes