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)
5 #ifndef BOOST_TYPEOF_TYPEOF_HPP_INCLUDED
6 #define BOOST_TYPEOF_TYPEOF_HPP_INCLUDED
8 #if defined(BOOST_TYPEOF_COMPLIANT)
9 # define BOOST_TYPEOF_EMULATION
12 #if defined(BOOST_TYPEOF_EMULATION) && defined(BOOST_TYPEOF_NATIVE)
13 # error both typeof emulation and native mode requested
18 # ifndef BOOST_TYPEOF_EMULATION
19 # ifndef BOOST_TYPEOF_NATIVE
20 # define BOOST_TYPEOF_NATIVE
22 # define BOOST_TYPEOF_KEYWORD typeof
25 # ifndef BOOST_TYPEOF_NATIVE
26 # ifndef BOOST_TYPEOF_EMULATION
27 # define BOOST_TYPEOF_EMULATION
30 # error native typeof is not supported
34 #elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)
36 # ifndef BOOST_TYPEOF_EMULATION
37 # ifndef BOOST_TYPEOF_NATIVE
38 # define BOOST_TYPEOF_NATIVE
40 # define BOOST_TYPEOF_KEYWORD __typeof__
43 # ifndef BOOST_TYPEOF_NATIVE
44 # ifndef BOOST_TYPEOF_EMULATION
45 # define BOOST_TYPEOF_EMULATION
48 # error native typeof is not supported
52 #elif defined(__GNUC__)
53 # ifndef BOOST_TYPEOF_EMULATION
54 # ifndef BOOST_TYPEOF_NATIVE
55 # define BOOST_TYPEOF_NATIVE
57 # define BOOST_TYPEOF_KEYWORD __typeof__
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
66 # define BOOST_TYPEOF_KEYWORD __typeof__
68 # define BOOST_TYPEOF_EMULATION_UNSUPPORTED
71 # ifndef BOOST_TYPEOF_EMULATION
72 # ifndef BOOST_TYPEOF_NATIVE
73 # define BOOST_TYPEOF_NATIVE
75 # define BOOST_TYPEOF_KEYWORD __typeof__
78 #elif defined __CODEGEARC__
79 # ifndef BOOST_TYPEOF_EMULATION
80 # ifndef BOOST_TYPEOF_NATIVE
81 # define BOOST_TYPEOF_EMULATION_UNSUPPORTED
84 # define BOOST_TYPEOF_EMULATION_UNSUPPORTED
86 #elif defined __BORLANDC__
87 # ifndef BOOST_TYPEOF_EMULATION
88 # ifndef BOOST_TYPEOF_NATIVE
89 # define BOOST_TYPEOF_EMULATION_UNSUPPORTED
92 # define BOOST_TYPEOF_EMULATION_UNSUPPORTED
95 # ifndef BOOST_TYPEOF_EMULATION
96 # ifndef BOOST_TYPEOF_NATIVE
97 # define BOOST_TYPEOF_NATIVE
99 # include <boost/typeof/dmc/typeof_impl.hpp>
100 # define MSVC_TYPEOF_HACK
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
108 # include <boost/typeof/msvc/typeof_impl.hpp>
109 # define MSVC_TYPEOF_HACK
111 # error typeof emulation is not supported
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
119 # define BOOST_TYPEOF_NATIVE
123 # ifdef BOOST_TYPEOF_NATIVE
124 # include <boost/typeof/msvc/typeof_impl.hpp>
125 # define MSVC_TYPEOF_HACK
128 #elif defined(__HP_aCC)
129 # ifndef BOOST_TYPEOF_NATIVE
130 # ifndef BOOST_TYPEOF_EMULATION
131 # define BOOST_TYPEOF_EMULATION
134 # error native typeof is not supported
137 #elif defined(__DECCXX)
138 # ifndef BOOST_TYPEOF_NATIVE
139 # ifndef BOOST_TYPEOF_EMULATION
140 # define BOOST_TYPEOF_EMULATION
143 # error native typeof is not supported
146 #elif defined(__BORLANDC__)
147 # if (__BORLANDC__ < 0x590)
148 # define BOOST_TYPEOF_NO_FUNCTION_TYPES
149 # define BOOST_TYPEOF_NO_MEMBER_FUNCTION_TYPES
151 # ifndef BOOST_TYPEOF_NATIVE
152 # ifndef BOOST_TYPEOF_EMULATION
153 # define BOOST_TYPEOF_EMULATION
156 # error native typeof is not supported
158 #elif defined(__SUNPRO_CC)
159 # if (__SUNPRO_CC < 0x590 )
160 # ifdef BOOST_TYPEOF_NATIVE
161 # error native typeof is not supported
163 # ifndef BOOST_TYPEOF_EMULATION
164 # define BOOST_TYPEOF_EMULATION
167 # ifndef BOOST_TYPEOF_EMULATION
168 # ifndef BOOST_TYPEOF_NATIVE
169 # define BOOST_TYPEOF_NATIVE
171 # define BOOST_TYPEOF_KEYWORD __typeof__
174 #else //unknown compiler
175 # ifndef BOOST_TYPEOF_NATIVE
176 # ifndef BOOST_TYPEOF_EMULATION
177 # define BOOST_TYPEOF_EMULATION
180 # ifndef BOOST_TYPEOF_KEYWORD
181 # define BOOST_TYPEOF_KEYWORD typeof
187 #define BOOST_TYPEOF_UNIQUE_ID()\
188 BOOST_TYPEOF_REGISTRATION_GROUP * 0x10000 + __LINE__
190 #define BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()\
191 <boost/typeof/incr_registration_group.hpp>
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>
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>
211 # error typeof configuration error
215 #define BOOST_AUTO(Var, Expr) BOOST_TYPEOF(Expr) Var = Expr
216 #define BOOST_AUTO_TPL(Var, Expr) BOOST_TYPEOF_TPL(Expr) Var = Expr
218 #endif//BOOST_TYPEOF_TYPEOF_HPP_INCLUDED