common_type.hpp
Go to the documentation of this file.
1 #ifndef BOOST_TYPE_TRAITS_COMMON_TYPE_HPP_INCLUDED
2 #define BOOST_TYPE_TRAITS_COMMON_TYPE_HPP_INCLUDED
3 
4 //
5 // Copyright 2015 Peter Dimov
6 //
7 // Distributed under the Boost Software License, Version 1.0.
8 // See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt
10 //
11 
12 #include <boost/config.hpp>
16 
17 #if defined(BOOST_NO_CXX11_DECLTYPE)
19 #endif
20 
21 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
23 #endif
24 
25 namespace boost
26 {
27 
28 // variadic common_type
29 
30 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
31 
32 template<class... T> struct common_type
33 {
34 };
35 
36 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
37 
38 template<class... T> using common_type_t = typename common_type<T...>::type;
39 
40 namespace type_traits_detail
41 {
42 
43 template<class T1, class T2, class... T> using common_type_fold = common_type_t<common_type_t<T1, T2>, T...>;
44 
45 } // namespace type_traits_detail
46 
47 template<class T1, class T2, class... T>
48 struct common_type<T1, T2, T...>: type_traits_detail::mp_defer<type_traits_detail::common_type_fold, T1, T2, T...>
49 {
50 };
51 
52 #else
53 
54 template<class T1, class T2, class... T>
55 struct common_type<T1, T2, T...>: common_type<typename common_type<T1, T2>::type, T...>
56 {
57 };
58 
59 #endif // !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
60 
61 #else
62 
63 template<
64  class T1 = void, class T2 = void, class T3 = void,
65  class T4 = void, class T5 = void, class T6 = void,
66  class T7 = void, class T8 = void, class T9 = void
67 >
68 struct common_type: common_type<typename common_type<T1, T2>::type, T3, T4, T5, T6, T7, T8, T9>
69 {
70 };
71 
72 #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
73 
74 // one argument
75 
76 template<class T> struct common_type<T>: boost::decay<T>
77 {
78 };
79 
80 // two arguments
81 
82 namespace type_traits_detail
83 {
84 
85 // binary common_type
86 
87 #if !defined(BOOST_NO_CXX11_DECLTYPE)
88 
89 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
90 
91 #if !defined(BOOST_MSVC) || BOOST_MSVC > 1800
92 
93 // internal compiler error on msvc-12.0
94 
95 template<class T1, class T2> using builtin_common_type = typename boost::decay<decltype( boost::declval<bool>()? boost::declval<T1>(): boost::declval<T2>() )>::type;
96 
97 template<class T1, class T2> struct common_type_impl: mp_defer<builtin_common_type, T1, T2>
98 {
99 };
100 
101 #else
102 
103 template<class T1, class T2> using builtin_common_type = decltype( boost::declval<bool>()? boost::declval<T1>(): boost::declval<T2>() );
104 
105 template<class T1, class T2> struct common_type_impl_2: mp_defer<builtin_common_type, T1, T2>
106 {
107 };
108 
109 template<class T1, class T2> using decay_common_type = typename boost::decay<typename common_type_impl_2<T1, T2>::type>::type;
110 
111 template<class T1, class T2> struct common_type_impl: mp_defer<decay_common_type, T1, T2>
112 {
113 };
114 
115 #endif // !defined(BOOST_MSVC) || BOOST_MSVC > 1800
116 
117 #else
118 
119 template<class T1, class T2> struct common_type_impl: boost::decay<decltype( boost::declval<bool>()? boost::declval<T1>(): boost::declval<T2>() )>
120 {
121 };
122 
123 #endif // #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
124 
125 #endif // #if !defined(BOOST_NO_CXX11_DECLTYPE)
126 
127 // decay helper
128 
130 {
131 };
132 
133 template<class T1, class T2> struct common_type_decay_helper<T1, T2, T1, T2>: common_type_impl<T1, T2>
134 {
135 };
136 
137 } // type_traits_detail
138 
139 template<class T1, class T2> struct common_type<T1, T2>: type_traits_detail::common_type_decay_helper<T1, T2>
140 {
141 };
142 
143 } // namespace boost
144 
145 #endif // #ifndef BOOST_TYPE_TRAITS_COMMON_TYPE_HPP_INCLUDED
typename boost::decay< decltype(boost::declval< bool >()?boost::declval< T1 >():boost::declval< T2 >())>::type builtin_common_type
Definition: common_type.hpp:95
typename boost::conditional< mp_valid< F, T... >::value, mp_defer_impl< F, T... >, mp_empty >::type mp_defer
Definition: mp_defer.hpp:50
boost::detail::decay_imp< Ty, boost::is_array< Ty >::value, boost::is_function< Ty >::value >::type type
Definition: decay.hpp:37
typedef void(APIENTRY *GLDEBUGPROC)(GLenum source
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
common_type_t< common_type_t< T1, T2 >, T... > common_type_fold
Definition: common_type.hpp:43
typename common_type< T... >::type common_type_t
Definition: common_type.hpp:38
add_rvalue_reference< T >::type declval() BOOST_NOEXCEPT
GLenum type


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:12