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 # error typeof emulation is not supported
71 # ifndef BOOST_TYPEOF_EMULATION
72 # ifndef BOOST_TYPEOF_NATIVE
73 # define BOOST_TYPEOF_NATIVE
75 # define BOOST_TYPEOF_KEYWORD __typeof__
79 #elif defined(_MSC_VER)
80 # if (_MSC_VER <= 1300) // 6.5, 7.0
81 # ifndef BOOST_TYPEOF_EMULATION
82 # ifndef BOOST_TYPEOF_NATIVE
83 # define BOOST_TYPEOF_NATIVE
85 # include <boost/typeof/msvc/typeof_impl.hpp>
86 # define MSVC_TYPEOF_HACK
88 # error typeof emulation is not supported
90 # elif (_MSC_VER == 1310) // 7.1
91 # ifndef BOOST_TYPEOF_EMULATION
92 # ifndef BOOST_TYPEOF_NATIVE
93 # define BOOST_TYPEOF_NATIVE
95 # include <boost/typeof/msvc/typeof_impl.hpp>
96 # define MSVC_TYPEOF_HACK
99 # ifndef BOOST_TYPEOF_NATIVE
100 # ifndef BOOST_TYPEOF_EMULATION
101 # define BOOST_TYPEOF_EMULATION
104 # error native typeof is not supported
108 #else //unknown compiler
109 # ifndef BOOST_TYPEOF_NATIVE
110 # ifndef BOOST_TYPEOF_EMULATION
111 # define BOOST_TYPEOF_EMULATION
114 # ifndef BOOST_TYPEOF_KEYWORD
115 # define BOOST_TYPEOF_KEYWORD typeof
121 #define BOOST_TYPEOF_UNIQUE_ID()\
122 BOOST_TYPEOF_REGISTRATION_GROUP * 0x10000 + __LINE__
124 #define BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()\
125 <boost/typeof/incr_registration_group.hpp>
127 #ifdef BOOST_TYPEOF_EMULATION
128 # define BOOST_TYPEOF_TEXT "using typeof emulation"
129 # include <boost/typeof/message.hpp>
130 # include <boost/typeof/typeof_impl.hpp>
131 # include <boost/typeof/type_encoding.hpp>
132 # include <boost/typeof/template_encoding.hpp>
133 # include <boost/typeof/modifiers.hpp>
134 # include <boost/typeof/pointers_data_members.hpp>
135 # include <boost/typeof/register_functions.hpp>
136 # include <boost/typeof/register_fundamental.hpp>
138 #elif defined(BOOST_TYPEOF_NATIVE)
139 # define BOOST_TYPEOF_TEXT "using native typeof"
140 # include <boost/typeof/message.hpp>
141 # include <boost/typeof/native.hpp>
143 # error typeof configuration error
147 #define BOOST_AUTO(Var, Expr) BOOST_TYPEOF(Expr) Var = Expr
148 #define BOOST_AUTO_TPL(Var, Expr) BOOST_TYPEOF_TPL(Expr) Var = Expr
150 #endif//BOOST_TYPEOF_TYPEOF_HPP_INCLUDED