Vcsn  2.1
Be Rational
type_traits.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <type_traits>
4 
5 namespace vcsn
6 {
7  /*---------.
8  | C++14. |
9  `---------*/
10 
11  // GCC 4.8 does not yet have std::enable_if_t and the like.
12  template <bool B, typename T, typename U>
14 
15  template <bool Cond, typename T = void>
17 
18  template <typename T, typename U>
20 
21  template <typename T>
23 
24  template <typename T>
26 
27  template <typename T>
29 
30  /*----------.
31  | C++ 17. |
32  `----------*/
33 
34  template <bool B>
35  using bool_constant = std::integral_constant<bool, B>;
36 
37  namespace detail
38  {
39  // See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4502.pdf.
40 #if __GNUC__ < 5 && ! defined __clang__
41  // http://stackoverflow.com/a/28967049/1353549
42  template <typename...>
43  struct voider
44  {
45  using type = void;
46  };
47  template <typename...Ts>
48  using void_t = typename voider<Ts...>::type;
49 #else
50  template <typename...>
51  using void_t = void;
52 #endif
53 
54  // Primary template handles all types not supporting the operation.
55  template <typename, template <typename> class, typename = void_t<>>
56  struct detect : std::false_type {};
57 
58  // Specialization recognizes/validates only types supporting the archetype.
59  template <typename T, template <typename> class Op>
60  struct detect<T, Op, void_t<Op<T>>> : std::true_type {};
61  }
62 }
typename std::remove_cv< T >::type remove_cv_t
Definition: type_traits.hh:25
std::string type(const automaton &a)
The implementation type of a.
Definition: others.cc:197
typename std::remove_const< T >::type remove_const_t
Definition: type_traits.hh:22
typename std::enable_if< Cond, T >::type enable_if_t
Definition: type_traits.hh:16
typename std::is_same< T, U >::type is_same_t
Definition: type_traits.hh:19
typename std::remove_reference< T >::type remove_reference_t
Definition: type_traits.hh:28
typename voider< Ts...>::type void_t
Definition: type_traits.hh:48
std::integral_constant< bool, B > bool_constant
Definition: type_traits.hh:35
typename std::conditional< B, T, U >::type conditional_t
Definition: type_traits.hh:13