Vcsn  2.3
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++ 17. |
9  `----------*/
10 
11  template <bool B>
12  using bool_constant = std::integral_constant<bool, B>;
13 
14  namespace detail
15  {
16  // See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4502.pdf.
17 #if __GNUC__ < 5 && ! defined __clang__
18  // http://stackoverflow.com/a/28967049/1353549
19  template <typename...>
20  struct voider
21  {
22  using type = void;
23  };
24  template <typename...Ts>
25  using void_t = typename voider<Ts...>::type;
26 #else
27  template <typename...>
28  using void_t = void;
29 #endif
30 
31  // Primary template handles all types not supporting the operation.
32  template <typename, template <typename> class, typename = void_t<>>
33  struct detect : std::false_type {};
34 
35  // Specialization recognizes/validates only types supporting the archetype.
36  template <typename T, template <typename> class Op>
37  struct detect<T, Op, void_t<Op<T>>> : std::true_type {};
38  }
39 }
std::string type(const automaton &a)
The implementation type of a.
Definition: others.cc:231
typename voider< Ts... >::type void_t
Definition: type_traits.hh:25
Definition: a-star.hh:8
std::integral_constant< bool, B > bool_constant
Definition: type_traits.hh:12