]>
Commit | Line | Data |
---|---|---|
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 | #if defined(__COMO__) | |
17 | # ifdef __GNUG__ | |
18 | # ifndef BOOST_TYPEOF_EMULATION | |
19 | # ifndef BOOST_TYPEOF_NATIVE | |
20 | # define BOOST_TYPEOF_NATIVE | |
21 | # endif | |
22 | # define BOOST_TYPEOF_KEYWORD typeof | |
23 | # endif | |
24 | # else | |
25 | # ifndef BOOST_TYPEOF_NATIVE | |
26 | # ifndef BOOST_TYPEOF_EMULATION | |
27 | # define BOOST_TYPEOF_EMULATION | |
28 | # endif | |
29 | # else | |
30 | # error native typeof is not supported | |
31 | # endif | |
32 | # endif | |
33 | ||
34 | #elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC) | |
35 | # ifdef __GNUC__ | |
36 | # ifndef BOOST_TYPEOF_EMULATION | |
37 | # ifndef BOOST_TYPEOF_NATIVE | |
38 | # define BOOST_TYPEOF_NATIVE | |
39 | # endif | |
40 | # define BOOST_TYPEOF_KEYWORD __typeof__ | |
41 | # endif | |
42 | # else | |
43 | # ifndef BOOST_TYPEOF_NATIVE | |
44 | # ifndef BOOST_TYPEOF_EMULATION | |
45 | # define BOOST_TYPEOF_EMULATION | |
46 | # endif | |
47 | # else | |
48 | # error native typeof is not supported | |
49 | # endif | |
50 | # endif | |
51 | ||
52 | #elif defined(__GNUC__) | |
53 | # ifndef BOOST_TYPEOF_EMULATION | |
54 | # ifndef BOOST_TYPEOF_NATIVE | |
55 | # define BOOST_TYPEOF_NATIVE | |
56 | # endif | |
57 | # define BOOST_TYPEOF_KEYWORD __typeof__ | |
58 | # endif | |
59 | ||
60 | #elif defined(__MWERKS__) | |
61 | # if(__MWERKS__ <= 0x3003) // 8.x | |
62 | # ifndef BOOST_TYPEOF_EMULATION | |
63 | # ifndef BOOST_TYPEOF_NATIVE | |
64 | # define BOOST_TYPEOF_NATIVE | |
65 | # endif | |
66 | # define BOOST_TYPEOF_KEYWORD __typeof__ | |
67 | # else | |
68 | # define BOOST_TYPEOF_EMULATION_UNSUPPORTED | |
69 | # endif | |
70 | # else // 9.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 | # endif | |
77 | # endif | |
78 | #elif defined __CODEGEARC__ | |
79 | # ifndef BOOST_TYPEOF_EMULATION | |
80 | # ifndef BOOST_TYPEOF_NATIVE | |
81 | # define BOOST_TYPEOF_EMULATION_UNSUPPORTED | |
82 | # endif | |
83 | # else | |
84 | # define BOOST_TYPEOF_EMULATION_UNSUPPORTED | |
85 | # endif | |
86 | #elif defined __BORLANDC__ | |
87 | # ifndef BOOST_TYPEOF_EMULATION | |
88 | # ifndef BOOST_TYPEOF_NATIVE | |
89 | # define BOOST_TYPEOF_EMULATION_UNSUPPORTED | |
90 | # endif | |
91 | # else | |
92 | # define BOOST_TYPEOF_EMULATION_UNSUPPORTED | |
93 | # endif | |
94 | #elif defined __DMC__ | |
95 | # ifndef BOOST_TYPEOF_EMULATION | |
96 | # ifndef BOOST_TYPEOF_NATIVE | |
97 | # define BOOST_TYPEOF_NATIVE | |
98 | # endif | |
99 | # include <boost/typeof/dmc/typeof_impl.hpp> | |
100 | # define MSVC_TYPEOF_HACK | |
101 | # endif | |
102 | #elif defined(_MSC_VER) | |
103 | # if (_MSC_VER <= 1300) // 6.5, 7.0 | |
104 | # ifndef BOOST_TYPEOF_EMULATION | |
105 | # ifndef BOOST_TYPEOF_NATIVE | |
106 | # define BOOST_TYPEOF_NATIVE | |
107 | # endif | |
108 | # include <boost/typeof/msvc/typeof_impl.hpp> | |
109 | # define MSVC_TYPEOF_HACK | |
110 | # else | |
111 | # error typeof emulation is not supported | |
112 | # endif | |
113 | # elif (_MSC_VER >= 1310) // 7.1 -> | |
114 | # ifndef BOOST_TYPEOF_EMULATION | |
115 | # ifndef BOOST_TYPEOF_NATIVE | |
116 | # ifndef _MSC_EXTENSIONS | |
117 | # define BOOST_TYPEOF_EMULATION | |
118 | # else | |
119 | # define BOOST_TYPEOF_NATIVE | |
120 | # endif | |
121 | # endif | |
122 | # endif | |
123 | # ifdef BOOST_TYPEOF_NATIVE | |
124 | # include <boost/typeof/msvc/typeof_impl.hpp> | |
125 | # define MSVC_TYPEOF_HACK | |
126 | # endif | |
127 | # endif | |
128 | #elif defined(__HP_aCC) | |
129 | # ifndef BOOST_TYPEOF_NATIVE | |
130 | # ifndef BOOST_TYPEOF_EMULATION | |
131 | # define BOOST_TYPEOF_EMULATION | |
132 | # endif | |
133 | # else | |
134 | # error native typeof is not supported | |
135 | # endif | |
136 | ||
137 | #elif defined(__DECCXX) | |
138 | # ifndef BOOST_TYPEOF_NATIVE | |
139 | # ifndef BOOST_TYPEOF_EMULATION | |
140 | # define BOOST_TYPEOF_EMULATION | |
141 | # endif | |
142 | # else | |
143 | # error native typeof is not supported | |
144 | # endif | |
145 | ||
146 | #elif defined(__BORLANDC__) | |
147 | # if (__BORLANDC__ < 0x590) | |
148 | # define BOOST_TYPEOF_NO_FUNCTION_TYPES | |
149 | # define BOOST_TYPEOF_NO_MEMBER_FUNCTION_TYPES | |
150 | # endif | |
151 | # ifndef BOOST_TYPEOF_NATIVE | |
152 | # ifndef BOOST_TYPEOF_EMULATION | |
153 | # define BOOST_TYPEOF_EMULATION | |
154 | # endif | |
155 | # else | |
156 | # error native typeof is not supported | |
157 | # endif | |
158 | #elif defined(__SUNPRO_CC) | |
159 | # if (__SUNPRO_CC < 0x590 ) | |
160 | # ifdef BOOST_TYPEOF_NATIVE | |
161 | # error native typeof is not supported | |
162 | # endif | |
163 | # ifndef BOOST_TYPEOF_EMULATION | |
164 | # define BOOST_TYPEOF_EMULATION | |
165 | # endif | |
166 | # else | |
167 | # ifndef BOOST_TYPEOF_EMULATION | |
168 | # ifndef BOOST_TYPEOF_NATIVE | |
169 | # define BOOST_TYPEOF_NATIVE | |
170 | # endif | |
171 | # define BOOST_TYPEOF_KEYWORD __typeof__ | |
172 | # endif | |
173 | # endif | |
174 | #else //unknown compiler | |
175 | # ifndef BOOST_TYPEOF_NATIVE | |
176 | # ifndef BOOST_TYPEOF_EMULATION | |
177 | # define BOOST_TYPEOF_EMULATION | |
178 | # endif | |
179 | # else | |
180 | # ifndef BOOST_TYPEOF_KEYWORD | |
181 | # define BOOST_TYPEOF_KEYWORD typeof | |
182 | # endif | |
183 | # endif | |
184 | ||
185 | #endif | |
186 | ||
187 | #define BOOST_TYPEOF_UNIQUE_ID()\ | |
188 | BOOST_TYPEOF_REGISTRATION_GROUP * 0x10000 + __LINE__ | |
189 | ||
190 | #define BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()\ | |
191 | <boost/typeof/incr_registration_group.hpp> | |
192 | ||
193 | #ifdef BOOST_TYPEOF_EMULATION_UNSUPPORTED | |
194 | # include <boost/typeof/unsupported.hpp> | |
195 | #elif defined BOOST_TYPEOF_EMULATION | |
196 | # define BOOST_TYPEOF_TEXT "using typeof emulation" | |
197 | # include <boost/typeof/message.hpp> | |
198 | # include <boost/typeof/typeof_impl.hpp> | |
199 | # include <boost/typeof/type_encoding.hpp> | |
200 | # include <boost/typeof/template_encoding.hpp> | |
201 | # include <boost/typeof/modifiers.hpp> | |
202 | # include <boost/typeof/pointers_data_members.hpp> | |
203 | # include <boost/typeof/register_functions.hpp> | |
204 | # include <boost/typeof/register_fundamental.hpp> | |
205 | ||
206 | #elif defined(BOOST_TYPEOF_NATIVE) | |
207 | # define BOOST_TYPEOF_TEXT "using native typeof" | |
208 | # include <boost/typeof/message.hpp> | |
209 | # include <boost/typeof/native.hpp> | |
210 | #else | |
211 | # error typeof configuration error | |
212 | #endif | |
213 | ||
214 | // auto | |
215 | #define BOOST_AUTO(Var, Expr) BOOST_TYPEOF(Expr) Var = Expr | |
216 | #define BOOST_AUTO_TPL(Var, Expr) BOOST_TYPEOF_TPL(Expr) Var = Expr | |
217 | ||
218 | #endif//BOOST_TYPEOF_TYPEOF_HPP_INCLUDED |