11#include <userver/utils/void_t.hpp>
13USERVER_NAMESPACE_BEGIN
19template <
typename Default,
typename AlwaysVoid,
template <
typename...>
typename Trait,
typename... Args>
21 using value_t = std::false_type;
25template <
typename Default,
template <
typename...>
typename Trait,
typename... Args>
26struct Detector<Default, utils::void_t<Trait<Args...>>, Trait, Args...> {
27 using value_t = std::true_type;
28 using type = Trait<Args...>;
31template <
template <
typename...>
typename Template,
typename T>
32struct IsInstantiationOf : std::false_type {};
34template <
template <
typename...>
typename Template,
typename... Args>
35struct IsInstantiationOf<Template, Template<Args...>> : std::true_type {};
42#if defined(__cpp_concepts) || defined(DOXYGEN)
58template <
template <
typename...>
typename Trait,
typename... Args>
59concept kIsDetected = requires {
typename Trait<Args...>; };
63template <
template <
typename...>
typename Trait,
typename... Args>
64inline constexpr bool kIsDetected = impl::Detector<NotDetected,
void, Trait, Args...>::value_t::value;
71template <
template <
typename...>
typename Trait,
typename... Args>
72using DetectedType =
typename impl::Detector<NotDetected,
void, Trait, Args...>::type;
77template <
typename Default,
template <
typename...>
typename Trait,
typename... Args>
78using DetectedOr =
typename impl::Detector<Default,
void, Trait, Args...>::type;
81template <
typename T,
typename U>
82using ExpectSame = std::enable_if_t<std::is_same_v<T, U>>;
85template <
template <
typename...>
typename Template,
typename T>