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
159 #else //unknown compiler
160 # ifndef BOOST_TYPEOF_NATIVE
161 # ifndef BOOST_TYPEOF_EMULATION
162 # define BOOST_TYPEOF_EMULATION
165 # ifndef BOOST_TYPEOF_KEYWORD
166 # define BOOST_TYPEOF_KEYWORD typeof
172 #define BOOST_TYPEOF_UNIQUE_ID()\
173 BOOST_TYPEOF_REGISTRATION_GROUP * 0x10000 + __LINE__
175 #define BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()\
176 <boost/typeof/incr_registration_group.hpp>
178 #ifdef BOOST_TYPEOF_EMULATION_UNSUPPORTED
179 # include <boost/typeof/unsupported.hpp>
180 #elif defined BOOST_TYPEOF_EMULATION
181 # define BOOST_TYPEOF_TEXT "using typeof emulation"
182 # include <boost/typeof/message.hpp>
183 # include <boost/typeof/typeof_impl.hpp>
184 # include <boost/typeof/type_encoding.hpp>
185 # include <boost/typeof/template_encoding.hpp>
186 # include <boost/typeof/modifiers.hpp>
187 # include <boost/typeof/pointers_data_members.hpp>
188 # include <boost/typeof/register_functions.hpp>
189 # include <boost/typeof/register_fundamental.hpp>
191 #elif defined(BOOST_TYPEOF_NATIVE)
192 # define BOOST_TYPEOF_TEXT "using native typeof"
193 # include <boost/typeof/message.hpp>
194 # include <boost/typeof/native.hpp>
196 # error typeof configuration error
200 #define BOOST_AUTO(Var, Expr) BOOST_TYPEOF(Expr) Var = Expr
201 #define BOOST_AUTO_TPL(Var, Expr) BOOST_TYPEOF_TPL(Expr) Var = Expr
203 #endif//BOOST_TYPEOF_TYPEOF_HPP_INCLUDED