My Project
common_type.hpp
Go to the documentation of this file.
1 
28 #ifndef BSL_COMMON_TYPE_HPP
29 #define BSL_COMMON_TYPE_HPP
30 
31 #include "decay.hpp"
32 #include "declval.hpp"
33 
34 namespace bsl
35 {
44  template<typename...>
45  struct common_type;
46 
48  template<typename... T>
49  using common_type_t = typename common_type<T...>::type;
50 
52 
53  template<typename T>
54  struct common_type<T> final
55  {
57  using type = decay_t<T>;
58  };
59 
60  template<typename T1, typename T2>
61  struct common_type<T1, T2> final
62  {
64  using type = decay_t<decltype(true ? declval<T1>() : declval<T2>())>; // NOLINT
65  };
66 
67  template<typename T1, typename T2, typename... R>
68  struct common_type<T1, T2, R...> final
69  {
71  using type = common_type_t<common_type_t<T1, T2>, R...>;
72  };
73 
75 }
76 
77 #endif
typename decay< T >::type decay_t
a helper that reduces the verbosity of bsl::decay
Definition: decay.hpp:64
typename common_type< T... >::type common_type_t
a helper that reduces the verbosity of bsl::common_type
Definition: common_type.hpp:49
Provides the member typedef type which is the type that is common between all provided types....
Definition: common_type.hpp:45