File tree Expand file tree Collapse file tree 2 files changed +20
-20
lines changed Expand file tree Collapse file tree 2 files changed +20
-20
lines changed Original file line number Diff line number Diff line change @@ -58,26 +58,6 @@ template <typename T> struct make_const_ref {
58
58
using type = std::add_lvalue_reference_t <std::add_const_t <T>>;
59
59
};
60
60
61
- namespace detail {
62
- template <class , template <class ...> class Op , class ... Args> struct detector {
63
- using value_t = std::false_type;
64
- };
65
- template <template <class ...> class Op , class ... Args>
66
- struct detector <std::void_t <Op<Args...>>, Op, Args...> {
67
- using value_t = std::true_type;
68
- };
69
- } // end namespace detail
70
-
71
- // / Detects if a given trait holds for some set of arguments 'Args'.
72
- // / For example, the given trait could be used to detect if a given type
73
- // / has a copy assignment operator:
74
- // / template<class T>
75
- // / using has_copy_assign_t = decltype(std::declval<T&>()
76
- // / = std::declval<const T&>());
77
- // / bool fooHasCopyAssign = is_detected<has_copy_assign_t, FooClass>::value;
78
- template <template <class ...> class Op , class ... Args>
79
- using is_detected = typename detail::detector<void , Op, Args...>::value_t ;
80
-
81
61
// / This class provides various trait information about a callable object.
82
62
// / * To access the number of arguments: Traits::num_args
83
63
// / * To access the type of an argument: Traits::arg_t<Index>
Original file line number Diff line number Diff line change @@ -49,6 +49,26 @@ template <typename T>
49
49
using type_identity_t // NOLINT(readability-identifier-naming)
50
50
= typename llvm::type_identity<T>::type;
51
51
52
+ namespace detail {
53
+ template <class , template <class ...> class Op , class ... Args> struct detector {
54
+ using value_t = std::false_type;
55
+ };
56
+ template <template <class ...> class Op , class ... Args>
57
+ struct detector <std::void_t <Op<Args...>>, Op, Args...> {
58
+ using value_t = std::true_type;
59
+ };
60
+ } // end namespace detail
61
+
62
+ // / Detects if a given trait holds for some set of arguments 'Args'.
63
+ // / For example, the given trait could be used to detect if a given type
64
+ // / has a copy assignment operator:
65
+ // / template<class T>
66
+ // / using has_copy_assign_t = decltype(std::declval<T&>()
67
+ // / = std::declval<const T&>());
68
+ // / bool fooHasCopyAssign = is_detected<has_copy_assign_t, FooClass>::value;
69
+ template <template <class ...> class Op , class ... Args>
70
+ using is_detected = typename detail::detector<void , Op, Args...>::value_t ;
71
+
52
72
// ===----------------------------------------------------------------------===//
53
73
// Features from C++23
54
74
// ===----------------------------------------------------------------------===//
You can’t perform that action at this time.
0 commit comments