fixed_point (deprecated)  rev.2
Binary Fixed-Point Arithmetic Library in C++
type_traits.h
1 
2 // Copyright John McFarlane 2015 - 2016.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file ../LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 
9 
10 #if !defined(SG14_TYPE_TRAITS_H)
11 #define SG14_TYPE_TRAITS_H 1
12 
13 #include <type_traits>
14 
16 namespace sg14 {
17  namespace _impl {
19  // sg14::_impl::common_type_t
20 
21  // pre-C++14 common_type_t
22  template<class ... T>
23  using common_type_t = typename std::common_type<T ...>::type;
24 
26  // sg14::_impl::enable_if_t
27 
28  // pre-C++14 enable_if_t
29  template<bool C, class ... T>
30  using enable_if_t = typename std::enable_if<C, T ...>::type;
31 
33  // sg14::_impl::identical - compiles iff same type; returns true iff equal
34 
35  template<class A, class B>
36  constexpr bool identical(const A& a, const B& b)
37  {
38  static_assert(std::is_same<A, B>::value, "different types");
39  return a==b;
40  }
41  }
42 }
43 
44 #endif // SG14_TYPE_TRAITS_H
study group 14 of the C++ working group
Definition: const_integer.h:22