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
16 #include <boost/config.hpp>
17 #include <boost/config/workaround.hpp>
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
25 #elif defined(__COMO__)
27 # ifndef BOOST_TYPEOF_EMULATION
28 # ifndef BOOST_TYPEOF_NATIVE
29 # define BOOST_TYPEOF_NATIVE
31 # define BOOST_TYPEOF_KEYWORD typeof
34 # ifndef BOOST_TYPEOF_NATIVE
35 # ifndef BOOST_TYPEOF_EMULATION
36 # define BOOST_TYPEOF_EMULATION
39 # error native typeof is not supported
43 #elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)
45 # ifndef BOOST_TYPEOF_EMULATION
46 # ifndef BOOST_TYPEOF_NATIVE
47 # define BOOST_TYPEOF_NATIVE
49 # define BOOST_TYPEOF_KEYWORD __typeof__
52 # ifndef BOOST_TYPEOF_NATIVE
53 # ifndef BOOST_TYPEOF_EMULATION
54 # define BOOST_TYPEOF_EMULATION
57 # error native typeof is not supported
61 #elif defined(__GNUC__) || defined(__clang__)
62 # ifndef BOOST_TYPEOF_EMULATION
63 # ifndef BOOST_TYPEOF_NATIVE
64 # define BOOST_TYPEOF_NATIVE
66 # define BOOST_TYPEOF_KEYWORD __typeof__
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
75 # define BOOST_TYPEOF_KEYWORD __typeof__
77 # define BOOST_TYPEOF_EMULATION_UNSUPPORTED
80 # ifndef BOOST_TYPEOF_EMULATION
81 # ifndef BOOST_TYPEOF_NATIVE
82 # define BOOST_TYPEOF_NATIVE
84 # define BOOST_TYPEOF_KEYWORD __typeof__
87 #elif defined BOOST_CODEGEARC
88 # ifndef BOOST_TYPEOF_EMULATION
89 # ifndef BOOST_TYPEOF_NATIVE
90 # define BOOST_TYPEOF_EMULATION_UNSUPPORTED
93 # define BOOST_TYPEOF_EMULATION_UNSUPPORTED
95 #elif defined BOOST_BORLANDC
96 # ifndef BOOST_TYPEOF_EMULATION
97 # ifndef BOOST_TYPEOF_NATIVE
98 # define BOOST_TYPEOF_EMULATION_UNSUPPORTED
101 # define BOOST_TYPEOF_EMULATION_UNSUPPORTED
103 #elif defined __DMC__
104 # ifndef BOOST_TYPEOF_EMULATION
105 # ifndef BOOST_TYPEOF_NATIVE
106 # define BOOST_TYPEOF_NATIVE
108 # include <boost/typeof/dmc/typeof_impl.hpp>
109 # define MSVC_TYPEOF_HACK
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
118 # define BOOST_TYPEOF_NATIVE
122 # ifdef BOOST_TYPEOF_NATIVE
123 # include <boost/typeof/msvc/typeof_impl.hpp>
124 # define MSVC_TYPEOF_HACK
127 #elif defined(__HP_aCC)
128 # ifndef BOOST_TYPEOF_NATIVE
129 # ifndef BOOST_TYPEOF_EMULATION
130 # define BOOST_TYPEOF_EMULATION
133 # error native typeof is not supported
136 #elif defined(__DECCXX)
137 # ifndef BOOST_TYPEOF_NATIVE
138 # ifndef BOOST_TYPEOF_EMULATION
139 # define BOOST_TYPEOF_EMULATION
142 # error native typeof is not supported
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
150 # ifndef BOOST_TYPEOF_NATIVE
151 # ifndef BOOST_TYPEOF_EMULATION
152 # define BOOST_TYPEOF_EMULATION
155 # error native typeof is not supported
157 #elif defined(__SUNPRO_CC)
158 # if (__SUNPRO_CC < 0x590 )
159 # ifdef BOOST_TYPEOF_NATIVE
160 # error native typeof is not supported
162 # ifndef BOOST_TYPEOF_EMULATION
163 # define BOOST_TYPEOF_EMULATION
166 # ifndef BOOST_TYPEOF_EMULATION
167 # ifndef BOOST_TYPEOF_NATIVE
168 # define BOOST_TYPEOF_NATIVE
170 # define BOOST_TYPEOF_KEYWORD __typeof__
173 #elif defined(__IBM__TYPEOF__)
174 # ifndef BOOST_TYPEOF_EMULATION
175 # ifndef BOOST_TYPEOF_NATIVE
176 # define BOOST_TYPEOF_NATIVE
178 # define BOOST_TYPEOF_KEYWORD __typeof__
180 #else //unknown compiler
181 # ifndef BOOST_TYPEOF_NATIVE
182 # ifndef BOOST_TYPEOF_EMULATION
183 # define BOOST_TYPEOF_EMULATION
186 # ifndef BOOST_TYPEOF_KEYWORD
187 # define BOOST_TYPEOF_KEYWORD typeof
193 #define BOOST_TYPEOF_UNIQUE_ID()\
194 BOOST_TYPEOF_REGISTRATION_GROUP * 0x10000 + __LINE__
196 #define BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()\
197 <boost/typeof/incr_registration_group.hpp>
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>
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>
218 # include <boost/typeof/native.hpp>
221 # error typeof configuration error
225 #define BOOST_AUTO(Var, Expr) BOOST_TYPEOF(Expr) Var = Expr
226 #define BOOST_AUTO_TPL(Var, Expr) BOOST_TYPEOF_TPL(Expr) Var = Expr
228 #endif//BOOST_TYPEOF_TYPEOF_HPP_INCLUDED