27 #ifndef CS_CRYPTO_UTIL_IS_DETECTED_TRAITS_H
28 #define CS_CRYPTO_UTIL_IS_DETECTED_TRAITS_H
30 #include <type_traits>
32 namespace cs_crypto::traits {
38 nonesuch(
const nonesuch &) =
delete;
39 nonesuch(nonesuch &&) =
delete;
43 void operator=(
const nonesuch &) =
delete;
44 void operator=(nonesuch &&) =
delete;
47 template<
class Default,
class AlwaysVoid,
template<
class...>
class Op,
class... Args>
50 using value_t = std::false_type;
54 template<
class Default,
template<
class...>
class Op,
class... Args>
55 struct detector<Default, std::void_t<Op<Args...>>, Op, Args...>
57 using value_t = std::true_type;
58 using type = Op<Args...>;
61 template<
template<
class...>
class Op,
class... Args>
62 using is_detected =
typename detector<nonesuch,
void, Op, Args...>::value_t;
64 template<
template<
class...>
class Op,
class... Args>
65 using detected_t =
typename detector<nonesuch,
void, Op, Args...>::type;
67 template<
template<
class...>
class Op,
class... Args>
68 constexpr bool is_detected_v = is_detected<Op, Args...>::value;
70 template<
class Default,
template<
class...>
class Op,
class... Args>
71 using detected_or = detector<Default,
void, Op, Args...>;
73 template<
class Default,
template<
class...>
class Op,
class... Args>
74 using detected_or_t =
typename detected_or<Default, Op, Args...>::type;