11#include <userver/utils/void_t.hpp>
13USERVER_NAMESPACE_BEGIN
19template <
typename Default,
typename AlwaysVoid,
20 template <
typename...>
typename Trait,
typename... Args>
22 using value_t = std::false_type;
26template <
typename Default,
template <
typename...>
typename Trait,
28struct Detector<Default, utils::void_t<Trait<Args...>>, Trait, Args...> {
29 using value_t = std::true_type;
30 using type = Trait<Args...>;
33template <
template <
typename...>
typename Template,
typename T>
34struct IsInstantiationOf : std::false_type {};
36template <
template <
typename...>
typename Template,
typename... Args>
37struct IsInstantiationOf<Template, Template<Args...>> : std::true_type {};
44#if defined(__cpp_concepts) || defined(DOXYGEN)
60template <
template <
typename...>
typename Trait,
typename... Args>
61concept kIsDetected = requires {
typename Trait<Args...>; };
65template <
template <
typename...>
typename Trait,
typename... Args>
66inline constexpr bool kIsDetected =
67 impl::Detector<NotDetected,
void, Trait, Args...>::value_t::value;
74template <
template <
typename...>
typename Trait,
typename... Args>
76 typename impl::Detector<
NotDetected,
void, Trait, Args...>::type;
81template <
typename Default,
template <
typename...>
typename Trait,
83using DetectedOr =
typename impl::Detector<Default,
void, Trait, Args...>::type;
86template <
typename T,
typename U>
87using ExpectSame = std::enable_if_t<std::is_same_v<T, U>>;
90template <
template <
typename...>
typename Template,
typename T>