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>
18 #if !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && !defined(BOOST_TYPEOF_EMULATION)
19 # define BOOST_TYPEOF_DECLTYPE
20 # ifndef BOOST_TYPEOF_NATIVE
21 # define BOOST_TYPEOF_NATIVE
24 #elif defined(__COMO__)
26 # ifndef BOOST_TYPEOF_EMULATION
27 # ifndef BOOST_TYPEOF_NATIVE
28 # define BOOST_TYPEOF_NATIVE
30 # define BOOST_TYPEOF_KEYWORD typeof
33 # ifndef BOOST_TYPEOF_NATIVE
34 # ifndef BOOST_TYPEOF_EMULATION
35 # define BOOST_TYPEOF_EMULATION
38 # error native typeof is not supported
42 #elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)
44 # ifndef BOOST_TYPEOF_EMULATION
45 # ifndef BOOST_TYPEOF_NATIVE
46 # define BOOST_TYPEOF_NATIVE
48 # define BOOST_TYPEOF_KEYWORD __typeof__
51 # ifndef BOOST_TYPEOF_NATIVE
52 # ifndef BOOST_TYPEOF_EMULATION
53 # define BOOST_TYPEOF_EMULATION
56 # error native typeof is not supported
60 #elif defined(__GNUC__) || defined(__clang__)
61 # ifndef BOOST_TYPEOF_EMULATION
62 # ifndef BOOST_TYPEOF_NATIVE
63 # define BOOST_TYPEOF_NATIVE
65 # define BOOST_TYPEOF_KEYWORD __typeof__
68 #elif defined(__MWERKS__)
69 # if(__MWERKS__ <= 0x3003) // 8.x
70 # ifndef BOOST_TYPEOF_EMULATION
71 # ifndef BOOST_TYPEOF_NATIVE
72 # define BOOST_TYPEOF_NATIVE
74 # define BOOST_TYPEOF_KEYWORD __typeof__
76 # define BOOST_TYPEOF_EMULATION_UNSUPPORTED
79 # ifndef BOOST_TYPEOF_EMULATION
80 # ifndef BOOST_TYPEOF_NATIVE
81 # define BOOST_TYPEOF_NATIVE
83 # define BOOST_TYPEOF_KEYWORD __typeof__
86 #elif defined __CODEGEARC__
87 # ifndef BOOST_TYPEOF_EMULATION
88 # ifndef BOOST_TYPEOF_NATIVE
89 # define BOOST_TYPEOF_EMULATION_UNSUPPORTED
92 # define BOOST_TYPEOF_EMULATION_UNSUPPORTED
94 #elif defined __BORLANDC__
95 # ifndef BOOST_TYPEOF_EMULATION
96 # ifndef BOOST_TYPEOF_NATIVE
97 # define BOOST_TYPEOF_EMULATION_UNSUPPORTED
100 # define BOOST_TYPEOF_EMULATION_UNSUPPORTED
102 #elif defined __DMC__
103 # ifndef BOOST_TYPEOF_EMULATION
104 # ifndef BOOST_TYPEOF_NATIVE
105 # define BOOST_TYPEOF_NATIVE
107 # include <boost/typeof/dmc/typeof_impl.hpp>
108 # define MSVC_TYPEOF_HACK
110 #elif defined(_MSC_VER)
111 # if (_MSC_VER >= 1310) // 7.1 ->
112 # ifndef BOOST_TYPEOF_EMULATION
113 # ifndef BOOST_TYPEOF_NATIVE
114 # ifndef _MSC_EXTENSIONS
115 # define BOOST_TYPEOF_EMULATION
117 # define BOOST_TYPEOF_NATIVE
121 # ifdef BOOST_TYPEOF_NATIVE
122 # include <boost/typeof/msvc/typeof_impl.hpp>
123 # define MSVC_TYPEOF_HACK
126 #elif defined(__HP_aCC)
127 # ifndef BOOST_TYPEOF_NATIVE
128 # ifndef BOOST_TYPEOF_EMULATION
129 # define BOOST_TYPEOF_EMULATION
132 # error native typeof is not supported
135 #elif defined(__DECCXX)
136 # ifndef BOOST_TYPEOF_NATIVE
137 # ifndef BOOST_TYPEOF_EMULATION
138 # define BOOST_TYPEOF_EMULATION
141 # error native typeof is not supported
144 #elif defined(__BORLANDC__)
145 # if (__BORLANDC__ < 0x590)
146 # define BOOST_TYPEOF_NO_FUNCTION_TYPES
147 # define BOOST_TYPEOF_NO_MEMBER_FUNCTION_TYPES
149 # ifndef BOOST_TYPEOF_NATIVE
150 # ifndef BOOST_TYPEOF_EMULATION
151 # define BOOST_TYPEOF_EMULATION
154 # error native typeof is not supported
156 #elif defined(__SUNPRO_CC)
157 # if (__SUNPRO_CC < 0x590 )
158 # ifdef BOOST_TYPEOF_NATIVE
159 # error native typeof is not supported
161 # ifndef BOOST_TYPEOF_EMULATION
162 # define BOOST_TYPEOF_EMULATION
165 # ifndef BOOST_TYPEOF_EMULATION
166 # ifndef BOOST_TYPEOF_NATIVE
167 # define BOOST_TYPEOF_NATIVE
169 # define BOOST_TYPEOF_KEYWORD __typeof__
172 #elif defined(__IBM__TYPEOF__)
173 # ifndef BOOST_TYPEOF_EMULATION
174 # ifndef BOOST_TYPEOF_NATIVE
175 # define BOOST_TYPEOF_NATIVE
177 # define BOOST_TYPEOF_KEYWORD __typeof__
179 #else //unknown compiler
180 # ifndef BOOST_TYPEOF_NATIVE
181 # ifndef BOOST_TYPEOF_EMULATION
182 # define BOOST_TYPEOF_EMULATION
185 # ifndef BOOST_TYPEOF_KEYWORD
186 # define BOOST_TYPEOF_KEYWORD typeof
192 #define BOOST_TYPEOF_UNIQUE_ID()\
193 BOOST_TYPEOF_REGISTRATION_GROUP * 0x10000 + __LINE__
195 #define BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()\
196 <boost/typeof/incr_registration_group.hpp>
198 #ifdef BOOST_TYPEOF_EMULATION_UNSUPPORTED
199 # include <boost/typeof/unsupported.hpp>
200 #elif defined BOOST_TYPEOF_EMULATION
201 # define BOOST_TYPEOF_TEXT "using typeof emulation"
202 # include <boost/typeof/message.hpp>
203 # include <boost/typeof/typeof_impl.hpp>
204 # include <boost/typeof/type_encoding.hpp>
205 # include <boost/typeof/template_encoding.hpp>
206 # include <boost/typeof/modifiers.hpp>
207 # include <boost/typeof/pointers_data_members.hpp>
208 # include <boost/typeof/register_functions.hpp>
209 # include <boost/typeof/register_fundamental.hpp>
211 #elif defined(BOOST_TYPEOF_NATIVE)
212 # define BOOST_TYPEOF_TEXT "using native typeof"
213 # include <boost/typeof/message.hpp>
214 # ifdef BOOST_TYPEOF_DECLTYPE
215 # include <boost/typeof/decltype.hpp>
217 # include <boost/typeof/native.hpp>
220 # error typeof configuration error
224 #define BOOST_AUTO(Var, Expr) BOOST_TYPEOF(Expr) Var = Expr
225 #define BOOST_AUTO_TPL(Var, Expr) BOOST_TYPEOF_TPL(Expr) Var = Expr
227 #endif//BOOST_TYPEOF_TYPEOF_HPP_INCLUDED