File indexing completed on 2025-01-18 09:57:37
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef DETECTED_H
0012 #define DETECTED_H
0013
0014
0015
0016
0017 #include <type_traits>
0018
0019 namespace Gaudi::cpp17 {
0020 namespace details {
0021
0022
0023 template <typename Default, typename AlwaysVoid, template <typename...> class Op, typename... Args>
0024 struct detector {
0025 constexpr static bool value = false;
0026 using type = Default;
0027 using value_t = std::false_type;
0028 };
0029
0030
0031 template <typename Default, template <typename...> class Op, typename... Args>
0032 struct detector<Default, std::void_t<Op<Args...>>, Op, Args...> {
0033 constexpr static bool value = true;
0034 using type = Op<Args...>;
0035 using value_t = std::true_type;
0036 };
0037 }
0038
0039 template <template <class...> class Op, class... Args>
0040 using is_detected = details::detector<void, void, Op, Args...>;
0041
0042 template <template <class...> class Op, class... Args>
0043 inline constexpr bool is_detected_v = is_detected<Op, Args...>::value;
0044
0045 template <template <class...> class Op, class... Args>
0046 using detected_t = typename is_detected<Op, Args...>::type;
0047
0048
0049 template <typename Default, template <typename...> class Op, typename... Args>
0050 using detected_or_t = typename details::detector<Default, void, Op, Args...>::type;
0051
0052 }
0053
0054 #endif