]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/typeof/typeof.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / typeof / typeof.hpp
1 // Copyright (C) 2004 Arkadiy Vertleyb
2 // Distributed under the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4
5 #ifndef BOOST_TYPEOF_TYPEOF_HPP_INCLUDED
6 #define BOOST_TYPEOF_TYPEOF_HPP_INCLUDED
7
8 #if defined(BOOST_TYPEOF_COMPLIANT)
9 # define BOOST_TYPEOF_EMULATION
10 #endif
11
12 #if defined(BOOST_TYPEOF_EMULATION) && defined(BOOST_TYPEOF_NATIVE)
13 # error both typeof emulation and native mode requested
14 #endif
15
16 #include <boost/config.hpp>
17 #include <boost/config/workaround.hpp>
18
19 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1900) && !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && !defined(BOOST_TYPEOF_EMULATION)
20 # define BOOST_TYPEOF_DECLTYPE
21 # ifndef BOOST_TYPEOF_NATIVE
22 # define BOOST_TYPEOF_NATIVE
23 # endif
24
25 #elif defined(__COMO__)
26 # ifdef __GNUG__
27 # ifndef BOOST_TYPEOF_EMULATION
28 # ifndef BOOST_TYPEOF_NATIVE
29 # define BOOST_TYPEOF_NATIVE
30 # endif
31 # define BOOST_TYPEOF_KEYWORD typeof
32 # endif
33 # else
34 # ifndef BOOST_TYPEOF_NATIVE
35 # ifndef BOOST_TYPEOF_EMULATION
36 # define BOOST_TYPEOF_EMULATION
37 # endif
38 # else
39 # error native typeof is not supported
40 # endif
41 # endif
42
43 #elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)
44 # ifdef __GNUC__
45 # ifndef BOOST_TYPEOF_EMULATION
46 # ifndef BOOST_TYPEOF_NATIVE
47 # define BOOST_TYPEOF_NATIVE
48 # endif
49 # define BOOST_TYPEOF_KEYWORD __typeof__
50 # endif
51 # else
52 # ifndef BOOST_TYPEOF_NATIVE
53 # ifndef BOOST_TYPEOF_EMULATION
54 # define BOOST_TYPEOF_EMULATION
55 # endif
56 # else
57 # error native typeof is not supported
58 # endif
59 # endif
60
61 #elif defined(__GNUC__) || defined(__clang__)
62 # ifndef BOOST_TYPEOF_EMULATION
63 # ifndef BOOST_TYPEOF_NATIVE
64 # define BOOST_TYPEOF_NATIVE
65 # endif
66 # define BOOST_TYPEOF_KEYWORD __typeof__
67 # endif
68
69 #elif defined(__MWERKS__)
70 # if(__MWERKS__ <= 0x3003) // 8.x
71 # ifndef BOOST_TYPEOF_EMULATION
72 # ifndef BOOST_TYPEOF_NATIVE
73 # define BOOST_TYPEOF_NATIVE
74 # endif
75 # define BOOST_TYPEOF_KEYWORD __typeof__
76 # else
77 # define BOOST_TYPEOF_EMULATION_UNSUPPORTED
78 # endif
79 # else // 9.x
80 # ifndef BOOST_TYPEOF_EMULATION
81 # ifndef BOOST_TYPEOF_NATIVE
82 # define BOOST_TYPEOF_NATIVE
83 # endif
84 # define BOOST_TYPEOF_KEYWORD __typeof__
85 # endif
86 # endif
87 #elif defined BOOST_CODEGEARC
88 # ifndef BOOST_TYPEOF_EMULATION
89 # ifndef BOOST_TYPEOF_NATIVE
90 # define BOOST_TYPEOF_EMULATION_UNSUPPORTED
91 # endif
92 # else
93 # define BOOST_TYPEOF_EMULATION_UNSUPPORTED
94 # endif
95 #elif defined BOOST_BORLANDC
96 # ifndef BOOST_TYPEOF_EMULATION
97 # ifndef BOOST_TYPEOF_NATIVE
98 # define BOOST_TYPEOF_EMULATION_UNSUPPORTED
99 # endif
100 # else
101 # define BOOST_TYPEOF_EMULATION_UNSUPPORTED
102 # endif
103 #elif defined __DMC__
104 # ifndef BOOST_TYPEOF_EMULATION
105 # ifndef BOOST_TYPEOF_NATIVE
106 # define BOOST_TYPEOF_NATIVE
107 # endif
108 # include <boost/typeof/dmc/typeof_impl.hpp>
109 # define MSVC_TYPEOF_HACK
110 # endif
111 #elif defined(_MSC_VER)
112 # if (_MSC_VER >= 1310) // 7.1 ->
113 # ifndef BOOST_TYPEOF_EMULATION
114 # ifndef BOOST_TYPEOF_NATIVE
115 # ifndef _MSC_EXTENSIONS
116 # define BOOST_TYPEOF_EMULATION
117 # else
118 # define BOOST_TYPEOF_NATIVE
119 # endif
120 # endif
121 # endif
122 # ifdef BOOST_TYPEOF_NATIVE
123 # include <boost/typeof/msvc/typeof_impl.hpp>
124 # define MSVC_TYPEOF_HACK
125 # endif
126 # endif
127 #elif defined(__HP_aCC)
128 # ifndef BOOST_TYPEOF_NATIVE
129 # ifndef BOOST_TYPEOF_EMULATION
130 # define BOOST_TYPEOF_EMULATION
131 # endif
132 # else
133 # error native typeof is not supported
134 # endif
135
136 #elif defined(__DECCXX)
137 # ifndef BOOST_TYPEOF_NATIVE
138 # ifndef BOOST_TYPEOF_EMULATION
139 # define BOOST_TYPEOF_EMULATION
140 # endif
141 # else
142 # error native typeof is not supported
143 # endif
144
145 #elif defined(BOOST_BORLANDC)
146 # if (BOOST_BORLANDC < 0x590)
147 # define BOOST_TYPEOF_NO_FUNCTION_TYPES
148 # define BOOST_TYPEOF_NO_MEMBER_FUNCTION_TYPES
149 # endif
150 # ifndef BOOST_TYPEOF_NATIVE
151 # ifndef BOOST_TYPEOF_EMULATION
152 # define BOOST_TYPEOF_EMULATION
153 # endif
154 # else
155 # error native typeof is not supported
156 # endif
157 #elif defined(__SUNPRO_CC)
158 # if (__SUNPRO_CC < 0x590 )
159 # ifdef BOOST_TYPEOF_NATIVE
160 # error native typeof is not supported
161 # endif
162 # ifndef BOOST_TYPEOF_EMULATION
163 # define BOOST_TYPEOF_EMULATION
164 # endif
165 # else
166 # ifndef BOOST_TYPEOF_EMULATION
167 # ifndef BOOST_TYPEOF_NATIVE
168 # define BOOST_TYPEOF_NATIVE
169 # endif
170 # define BOOST_TYPEOF_KEYWORD __typeof__
171 # endif
172 # endif
173 #elif defined(__IBM__TYPEOF__)
174 # ifndef BOOST_TYPEOF_EMULATION
175 # ifndef BOOST_TYPEOF_NATIVE
176 # define BOOST_TYPEOF_NATIVE
177 # endif
178 # define BOOST_TYPEOF_KEYWORD __typeof__
179 # endif
180 #else //unknown compiler
181 # ifndef BOOST_TYPEOF_NATIVE
182 # ifndef BOOST_TYPEOF_EMULATION
183 # define BOOST_TYPEOF_EMULATION
184 # endif
185 # else
186 # ifndef BOOST_TYPEOF_KEYWORD
187 # define BOOST_TYPEOF_KEYWORD typeof
188 # endif
189 # endif
190
191 #endif
192
193 #define BOOST_TYPEOF_UNIQUE_ID()\
194 BOOST_TYPEOF_REGISTRATION_GROUP * 0x10000 + __LINE__
195
196 #define BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()\
197 <boost/typeof/incr_registration_group.hpp>
198
199 #ifdef BOOST_TYPEOF_EMULATION_UNSUPPORTED
200 # include <boost/typeof/unsupported.hpp>
201 #elif defined BOOST_TYPEOF_EMULATION
202 # define BOOST_TYPEOF_TEXT "using typeof emulation"
203 # include <boost/typeof/message.hpp>
204 # include <boost/typeof/typeof_impl.hpp>
205 # include <boost/typeof/type_encoding.hpp>
206 # include <boost/typeof/template_encoding.hpp>
207 # include <boost/typeof/modifiers.hpp>
208 # include <boost/typeof/pointers_data_members.hpp>
209 # include <boost/typeof/register_functions.hpp>
210 # include <boost/typeof/register_fundamental.hpp>
211
212 #elif defined(BOOST_TYPEOF_NATIVE)
213 # define BOOST_TYPEOF_TEXT "using native typeof"
214 # include <boost/typeof/message.hpp>
215 # ifdef BOOST_TYPEOF_DECLTYPE
216 # include <boost/typeof/decltype.hpp>
217 # else
218 # include <boost/typeof/native.hpp>
219 # endif
220 #else
221 # error typeof configuration error
222 #endif
223
224 // auto
225 #define BOOST_AUTO(Var, Expr) BOOST_TYPEOF(Expr) Var = Expr
226 #define BOOST_AUTO_TPL(Var, Expr) BOOST_TYPEOF_TPL(Expr) Var = Expr
227
228 #endif//BOOST_TYPEOF_TYPEOF_HPP_INCLUDED