Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 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 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 5 | #ifndef NDNBOOST_TYPEOF_TYPEOF_HPP_INCLUDED |
| 6 | #define NDNBOOST_TYPEOF_TYPEOF_HPP_INCLUDED |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 7 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 8 | #if defined(NDNBOOST_TYPEOF_COMPLIANT) |
| 9 | # define NDNBOOST_TYPEOF_EMULATION |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 10 | #endif |
| 11 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 12 | #if defined(NDNBOOST_TYPEOF_EMULATION) && defined(NDNBOOST_TYPEOF_NATIVE) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 13 | # error both typeof emulation and native mode requested |
| 14 | #endif |
| 15 | |
| 16 | #if defined(__COMO__) |
| 17 | # ifdef __GNUG__ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 18 | # ifndef NDNBOOST_TYPEOF_EMULATION |
| 19 | # ifndef NDNBOOST_TYPEOF_NATIVE |
| 20 | # define NDNBOOST_TYPEOF_NATIVE |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 21 | # endif |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 22 | # define NDNBOOST_TYPEOF_KEYWORD typeof |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 23 | # endif |
| 24 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 25 | # ifndef NDNBOOST_TYPEOF_NATIVE |
| 26 | # ifndef NDNBOOST_TYPEOF_EMULATION |
| 27 | # define NDNBOOST_TYPEOF_EMULATION |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 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__ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 36 | # ifndef NDNBOOST_TYPEOF_EMULATION |
| 37 | # ifndef NDNBOOST_TYPEOF_NATIVE |
| 38 | # define NDNBOOST_TYPEOF_NATIVE |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 39 | # endif |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 40 | # define NDNBOOST_TYPEOF_KEYWORD __typeof__ |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 41 | # endif |
| 42 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 43 | # ifndef NDNBOOST_TYPEOF_NATIVE |
| 44 | # ifndef NDNBOOST_TYPEOF_EMULATION |
| 45 | # define NDNBOOST_TYPEOF_EMULATION |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 46 | # endif |
| 47 | # else |
| 48 | # error native typeof is not supported |
| 49 | # endif |
| 50 | # endif |
| 51 | |
| 52 | #elif defined(__GNUC__) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 53 | # ifndef NDNBOOST_TYPEOF_EMULATION |
| 54 | # ifndef NDNBOOST_TYPEOF_NATIVE |
| 55 | # define NDNBOOST_TYPEOF_NATIVE |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 56 | # endif |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 57 | # define NDNBOOST_TYPEOF_KEYWORD __typeof__ |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 58 | # endif |
| 59 | |
| 60 | #elif defined(__MWERKS__) |
| 61 | # if(__MWERKS__ <= 0x3003) // 8.x |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 62 | # ifndef NDNBOOST_TYPEOF_EMULATION |
| 63 | # ifndef NDNBOOST_TYPEOF_NATIVE |
| 64 | # define NDNBOOST_TYPEOF_NATIVE |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 65 | # endif |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 66 | # define NDNBOOST_TYPEOF_KEYWORD __typeof__ |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 67 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 68 | # define NDNBOOST_TYPEOF_EMULATION_UNSUPPORTED |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 69 | # endif |
| 70 | # else // 9.x |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 71 | # ifndef NDNBOOST_TYPEOF_EMULATION |
| 72 | # ifndef NDNBOOST_TYPEOF_NATIVE |
| 73 | # define NDNBOOST_TYPEOF_NATIVE |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 74 | # endif |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 75 | # define NDNBOOST_TYPEOF_KEYWORD __typeof__ |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 76 | # endif |
| 77 | # endif |
| 78 | #elif defined __CODEGEARC__ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 79 | # ifndef NDNBOOST_TYPEOF_EMULATION |
| 80 | # ifndef NDNBOOST_TYPEOF_NATIVE |
| 81 | # define NDNBOOST_TYPEOF_EMULATION_UNSUPPORTED |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 82 | # endif |
| 83 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 84 | # define NDNBOOST_TYPEOF_EMULATION_UNSUPPORTED |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 85 | # endif |
| 86 | #elif defined __BORLANDC__ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 87 | # ifndef NDNBOOST_TYPEOF_EMULATION |
| 88 | # ifndef NDNBOOST_TYPEOF_NATIVE |
| 89 | # define NDNBOOST_TYPEOF_EMULATION_UNSUPPORTED |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 90 | # endif |
| 91 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 92 | # define NDNBOOST_TYPEOF_EMULATION_UNSUPPORTED |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 93 | # endif |
| 94 | #elif defined __DMC__ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 95 | # ifndef NDNBOOST_TYPEOF_EMULATION |
| 96 | # ifndef NDNBOOST_TYPEOF_NATIVE |
| 97 | # define NDNBOOST_TYPEOF_NATIVE |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 98 | # endif |
| 99 | # include <ndnboost/typeof/dmc/typeof_impl.hpp> |
| 100 | # define MSVC_TYPEOF_HACK |
| 101 | # endif |
| 102 | #elif defined(_MSC_VER) |
| 103 | # if (_MSC_VER <= 1300) // 6.5, 7.0 |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 104 | # ifndef NDNBOOST_TYPEOF_EMULATION |
| 105 | # ifndef NDNBOOST_TYPEOF_NATIVE |
| 106 | # define NDNBOOST_TYPEOF_NATIVE |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 107 | # endif |
| 108 | # include <ndnboost/typeof/msvc/typeof_impl.hpp> |
| 109 | # define MSVC_TYPEOF_HACK |
| 110 | # else |
| 111 | # error typeof emulation is not supported |
| 112 | # endif |
| 113 | # elif (_MSC_VER >= 1310) // 7.1 -> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 114 | # ifndef NDNBOOST_TYPEOF_EMULATION |
| 115 | # ifndef NDNBOOST_TYPEOF_NATIVE |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 116 | # ifndef _MSC_EXTENSIONS |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 117 | # define NDNBOOST_TYPEOF_EMULATION |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 118 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 119 | # define NDNBOOST_TYPEOF_NATIVE |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 120 | # endif |
| 121 | # endif |
| 122 | # endif |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 123 | # ifdef NDNBOOST_TYPEOF_NATIVE |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 124 | # include <ndnboost/typeof/msvc/typeof_impl.hpp> |
| 125 | # define MSVC_TYPEOF_HACK |
| 126 | # endif |
| 127 | # endif |
| 128 | #elif defined(__HP_aCC) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 129 | # ifndef NDNBOOST_TYPEOF_NATIVE |
| 130 | # ifndef NDNBOOST_TYPEOF_EMULATION |
| 131 | # define NDNBOOST_TYPEOF_EMULATION |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 132 | # endif |
| 133 | # else |
| 134 | # error native typeof is not supported |
| 135 | # endif |
| 136 | |
| 137 | #elif defined(__DECCXX) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 138 | # ifndef NDNBOOST_TYPEOF_NATIVE |
| 139 | # ifndef NDNBOOST_TYPEOF_EMULATION |
| 140 | # define NDNBOOST_TYPEOF_EMULATION |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 141 | # endif |
| 142 | # else |
| 143 | # error native typeof is not supported |
| 144 | # endif |
| 145 | |
| 146 | #elif defined(__BORLANDC__) |
| 147 | # if (__BORLANDC__ < 0x590) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 148 | # define NDNBOOST_TYPEOF_NO_FUNCTION_TYPES |
| 149 | # define NDNBOOST_TYPEOF_NO_MEMBER_FUNCTION_TYPES |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 150 | # endif |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 151 | # ifndef NDNBOOST_TYPEOF_NATIVE |
| 152 | # ifndef NDNBOOST_TYPEOF_EMULATION |
| 153 | # define NDNBOOST_TYPEOF_EMULATION |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 154 | # endif |
| 155 | # else |
| 156 | # error native typeof is not supported |
| 157 | # endif |
| 158 | #elif defined(__SUNPRO_CC) |
| 159 | # if (__SUNPRO_CC < 0x590 ) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 160 | # ifdef NDNBOOST_TYPEOF_NATIVE |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 161 | # error native typeof is not supported |
| 162 | # endif |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 163 | # ifndef NDNBOOST_TYPEOF_EMULATION |
| 164 | # define NDNBOOST_TYPEOF_EMULATION |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 165 | # endif |
| 166 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 167 | # ifndef NDNBOOST_TYPEOF_EMULATION |
| 168 | # ifndef NDNBOOST_TYPEOF_NATIVE |
| 169 | # define NDNBOOST_TYPEOF_NATIVE |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 170 | # endif |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 171 | # define NDNBOOST_TYPEOF_KEYWORD __typeof__ |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 172 | # endif |
| 173 | # endif |
| 174 | #else //unknown compiler |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 175 | # ifndef NDNBOOST_TYPEOF_NATIVE |
| 176 | # ifndef NDNBOOST_TYPEOF_EMULATION |
| 177 | # define NDNBOOST_TYPEOF_EMULATION |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 178 | # endif |
| 179 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 180 | # ifndef NDNBOOST_TYPEOF_KEYWORD |
| 181 | # define NDNBOOST_TYPEOF_KEYWORD typeof |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 182 | # endif |
| 183 | # endif |
| 184 | |
| 185 | #endif |
| 186 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 187 | #define NDNBOOST_TYPEOF_UNIQUE_ID()\ |
| 188 | NDNBOOST_TYPEOF_REGISTRATION_GROUP * 0x10000 + __LINE__ |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 189 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 190 | #define NDNBOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()\ |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 191 | <ndnboost/typeof/incr_registration_group.hpp> |
| 192 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 193 | #ifdef NDNBOOST_TYPEOF_EMULATION_UNSUPPORTED |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 194 | # include <ndnboost/typeof/unsupported.hpp> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 195 | #elif defined NDNBOOST_TYPEOF_EMULATION |
| 196 | # define NDNBOOST_TYPEOF_TEXT "using typeof emulation" |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 197 | # include <ndnboost/typeof/message.hpp> |
| 198 | # include <ndnboost/typeof/typeof_impl.hpp> |
| 199 | # include <ndnboost/typeof/type_encoding.hpp> |
| 200 | # include <ndnboost/typeof/template_encoding.hpp> |
| 201 | # include <ndnboost/typeof/modifiers.hpp> |
| 202 | # include <ndnboost/typeof/pointers_data_members.hpp> |
| 203 | # include <ndnboost/typeof/register_functions.hpp> |
| 204 | # include <ndnboost/typeof/register_fundamental.hpp> |
| 205 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 206 | #elif defined(NDNBOOST_TYPEOF_NATIVE) |
| 207 | # define NDNBOOST_TYPEOF_TEXT "using native typeof" |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 208 | # include <ndnboost/typeof/message.hpp> |
| 209 | # include <ndnboost/typeof/native.hpp> |
| 210 | #else |
| 211 | # error typeof configuration error |
| 212 | #endif |
| 213 | |
| 214 | // auto |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 215 | #define NDNBOOST_AUTO(Var, Expr) NDNBOOST_TYPEOF(Expr) Var = Expr |
| 216 | #define NDNBOOST_AUTO_TPL(Var, Expr) NDNBOOST_TYPEOF_TPL(Expr) Var = Expr |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 217 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 218 | #endif//NDNBOOST_TYPEOF_TYPEOF_HPP_INCLUDED |