Pretty Good Sum Type  1.0.0
type_traits.hpp
Go to the documentation of this file.
1 #if !defined(TYPE_TRAITS_FF88A4C7_86DE_434F_93B7_B03DCA5B4578_H)
2 # define TYPE_TRAITS_FF88A4C7_86DE_434F_93B7_B03DCA5B4578_H
3 
9 
10 # include <type_traits>
11 
12 namespace pgs {
13 
14  //-- Borrow from the future
15 
16  //C++14
17  template <class T>
18  using decay_t = typename std::decay<T>::type;
19 
20  //C++14
21  template <bool B, class T = void>
22  using enable_if_t = typename std::enable_if<B, T>::type;
23 
24  // C++17
25  template <class B>
26  struct negation : std::integral_constant <bool, !B::value>
27  {};
28 
29  //--
30 
32  template <class T, class U>
34 
36  namespace detail {
37  struct no {};
38  }//namespace detail
40 
44 
45  template<typename F, typename...Args>
46  struct is_callable {
47 
49  template<class G, class...Qs>
50  static auto check(G g, Qs...qs) -> decltype(g(qs...));
51 
52  static detail::no check(...);
53 
54  static constexpr bool value =
55  !std::is_same<
56  detail::no
57  , decltype(check (std::declval<F>(), std::declval<Args>()...))>::value;
58 
60 
61  };
62 
63 }//namespace pgs
64 
65 #endif
Definition: logical.hpp:13
Definition: type_traits.hpp:26
Metafunction to determine if an instance of a type F can be applied to a tuple of parameters with typ...
Definition: type_traits.hpp:46