7228b5c5fd7e7ecd84e61dfc57f4e6dc4eca25a3
[senf.git] / boost / typeof / typeof.hpp
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)
4
5 #ifndef BOOST_TYPEOF_TYPEOF_HPP_INCLUDED
6 #define BOOST_TYPEOF_TYPEOF_HPP_INCLUDED
7
8 #if defined(BOOST_TYPEOF_COMPLIANT)
9 #   define BOOST_TYPEOF_EMULATION
10 #endif
11
12 #if defined(BOOST_TYPEOF_EMULATION) && defined(BOOST_TYPEOF_NATIVE)
13 #   error both typeof emulation and native mode requested 
14 #endif
15
16 #if defined(__COMO__)
17 #   ifdef __GNUG__
18 #       ifndef(BOOST_TYPEOF_EMULATION)
19 #           ifndef BOOST_TYPEOF_NATIVE
20 #               define BOOST_TYPEOF_NATIVE
21 #           endif
22 #           define BOOST_TYPEOF_KEYWORD typeof
23 #       endif
24 #   else
25 #       ifndef BOOST_TYPEOF_NATIVE
26 #           ifndef BOOST_TYPEOF_EMULATION
27 #               define BOOST_TYPEOF_EMULATION
28 #           endif
29 #       else
30 #           error native typeof is not supported
31 #       endif
32 #   endif
33
34 #elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)
35 #   ifdef __GNUC__
36 #       ifndef BOOST_TYPEOF_EMULATION
37 #           ifndef BOOST_TYPEOF_NATIVE
38 #               define BOOST_TYPEOF_NATIVE
39 #           endif
40 #           define BOOST_TYPEOF_KEYWORD __typeof__
41 #       endif
42 #   else
43 #       ifndef BOOST_TYPEOF_NATIVE
44 #           ifndef BOOST_TYPEOF_EMULATION
45 #               define BOOST_TYPEOF_EMULATION
46 #           endif
47 #       else
48 #           error native typeof is not supported
49 #       endif
50 #   endif
51
52 #elif defined(__GNUC__)
53 #   ifndef BOOST_TYPEOF_EMULATION
54 #       ifndef BOOST_TYPEOF_NATIVE
55 #           define BOOST_TYPEOF_NATIVE
56 #       endif
57 #       define BOOST_TYPEOF_KEYWORD __typeof__
58 #   endif
59
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
65 #           endif
66 #           define BOOST_TYPEOF_KEYWORD __typeof__
67 #       else
68 #           error typeof emulation is not supported
69 #       endif
70 #   else // 9.x
71 #       ifndef BOOST_TYPEOF_EMULATION
72 #           ifndef BOOST_TYPEOF_NATIVE
73 #               define BOOST_TYPEOF_NATIVE
74 #           endif
75 #           define BOOST_TYPEOF_KEYWORD __typeof__
76 #       endif
77 #   endif
78
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
84 #           endif
85 #           include <boost/typeof/msvc/typeof_impl.hpp>
86 #           define MSVC_TYPEOF_HACK
87 #       else
88 #           error typeof emulation is not supported
89 #       endif
90 #   elif (_MSC_VER == 1310)  // 7.1
91 #       ifndef BOOST_TYPEOF_EMULATION
92 #           ifndef BOOST_TYPEOF_NATIVE
93 #               define BOOST_TYPEOF_NATIVE
94 #           endif
95 #           include <boost/typeof/msvc/typeof_impl.hpp>
96 #           define MSVC_TYPEOF_HACK
97 #       endif
98 #   else // 8.0
99 #       ifndef BOOST_TYPEOF_NATIVE
100 #           ifndef BOOST_TYPEOF_EMULATION
101 #               define BOOST_TYPEOF_EMULATION
102 #           endif
103 #       else
104 #           error native typeof is not supported
105 #       endif
106 #   endif
107
108 #else //unknown compiler
109 #   ifndef BOOST_TYPEOF_NATIVE
110 #       ifndef BOOST_TYPEOF_EMULATION
111 #           define BOOST_TYPEOF_EMULATION
112 #       endif
113 #   else
114 #       ifndef BOOST_TYPEOF_KEYWORD
115 #           define BOOST_TYPEOF_KEYWORD typeof
116 #       endif
117 #   endif
118
119 #endif
120
121 #define BOOST_TYPEOF_UNIQUE_ID()\
122      BOOST_TYPEOF_REGISTRATION_GROUP * 0x10000 + __LINE__
123
124 #define BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()\
125      <boost/typeof/incr_registration_group.hpp>
126
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>
137
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>
142 #else
143 #   error typeof configuration error
144 #endif
145
146 // auto
147 #define BOOST_AUTO(Var, Expr) BOOST_TYPEOF(Expr) Var = Expr
148 #define BOOST_AUTO_TPL(Var, Expr) BOOST_TYPEOF_TPL(Expr) Var = Expr
149
150 #endif//BOOST_TYPEOF_TYPEOF_HPP_INCLUDED