@@ -88,37 +88,6 @@ inline void interleaveComma(const Container &c, raw_ostream &os) {
88
88
interleaveComma (c, os, [&](const T &a) { os << a; });
89
89
}
90
90
91
- // / Utilities for detecting if a given trait holds for some set of arguments
92
- // / 'Args'. For example, the given trait could be used to detect if a given type
93
- // / has a copy assignment operator:
94
- // / template<class T>
95
- // / using has_copy_assign_t = decltype(std::declval<T&>()
96
- // / = std::declval<const T&>());
97
- // / bool fooHasCopyAssign = is_detected<has_copy_assign_t, FooClass>::value;
98
- namespace detail {
99
- template <typename ...> using void_t = void ;
100
- template <class , template <class ...> class Op , class ... Args> struct detector {
101
- using value_t = std::false_type;
102
- };
103
- template <template <class ...> class Op , class ... Args>
104
- struct detector <void_t <Op<Args...>>, Op, Args...> {
105
- using value_t = std::true_type;
106
- };
107
- } // end namespace detail
108
-
109
- template <template <class ...> class Op , class ... Args>
110
- using is_detected = typename detail::detector<void , Op, Args...>::value_t ;
111
-
112
- // / Check if a Callable type can be invoked with the given set of arg types.
113
- namespace detail {
114
- template <typename Callable, typename ... Args>
115
- using is_invocable =
116
- decltype (std::declval<Callable &>()(std::declval<Args>()...));
117
- } // namespace detail
118
-
119
- template <typename Callable, typename ... Args>
120
- using is_invocable = is_detected<detail::is_invocable, Callable, Args...>;
121
-
122
91
// ===----------------------------------------------------------------------===//
123
92
// Extra additions to <iterator>
124
93
// ===----------------------------------------------------------------------===//
@@ -356,47 +325,6 @@ template <typename ContainerTy> bool has_single_element(ContainerTy &&c) {
356
325
return it != e && std::next (it) == e;
357
326
}
358
327
359
- // ===----------------------------------------------------------------------===//
360
- // Extra additions to <type_traits>
361
- // ===----------------------------------------------------------------------===//
362
-
363
- // / This class provides various trait information about a callable object.
364
- // / * To access the number of arguments: Traits::num_args
365
- // / * To access the type of an argument: Traits::arg_t<i>
366
- // / * To access the type of the result: Traits::result_t<i>
367
- template <typename T, bool isClass = std::is_class<T>::value>
368
- struct FunctionTraits : public FunctionTraits <decltype(&T::operator ())> {};
369
-
370
- // / Overload for class function types.
371
- template <typename ClassType, typename ReturnType, typename ... Args>
372
- struct FunctionTraits <ReturnType (ClassType::*)(Args...) const , false > {
373
- // / The number of arguments to this function.
374
- enum { num_args = sizeof ...(Args) };
375
-
376
- // / The result type of this function.
377
- using result_t = ReturnType;
378
-
379
- // / The type of an argument to this function.
380
- template <size_t i>
381
- using arg_t = typename std::tuple_element<i, std::tuple<Args...>>::type;
382
- };
383
- // / Overload for non-class function types.
384
- template <typename ReturnType, typename ... Args>
385
- struct FunctionTraits <ReturnType (*)(Args...), false > {
386
- // / The number of arguments to this function.
387
- enum { num_args = sizeof ...(Args) };
388
-
389
- // / The result type of this function.
390
- using result_t = ReturnType;
391
-
392
- // / The type of an argument to this function.
393
- template <size_t i>
394
- using arg_t = typename std::tuple_element<i, std::tuple<Args...>>::type;
395
- };
396
- // / Overload for non-class function type references.
397
- template <typename ReturnType, typename ... Args>
398
- struct FunctionTraits <ReturnType (&)(Args...), false >
399
- : public FunctionTraits<ReturnType (*)(Args...)> {};
400
328
} // end namespace mlir
401
329
402
330
#endif // MLIR_SUPPORT_STLEXTRAS_H
0 commit comments