|
1 // Boost config.hpp configuration header file ------------------------------// |
|
2 |
|
3 // Copyright (c) 2001-2003 John Maddock |
|
4 // Copyright (c) 2001 Darin Adler |
|
5 // Copyright (c) 2001 Peter Dimov |
|
6 // Copyright (c) 2002 Bill Kempf |
|
7 // Copyright (c) 2002 Jens Maurer |
|
8 // Copyright (c) 2002-2003 David Abrahams |
|
9 // Copyright (c) 2003 Gennaro Prota |
|
10 // Copyright (c) 2003 Eric Friedman |
|
11 // |
|
12 // Distributed under the Boost Software License, Version 1.0. (See |
|
13 // accompanying file LICENSE_1_0.txt or copy at |
|
14 // http://www.boost.org/LICENSE_1_0.txt) |
|
15 |
|
16 // See http://www.boost.org/ for most recent version. |
|
17 |
|
18 // Boost config.hpp policy and rationale documentation has been moved to |
|
19 // http://www.boost.org/libs/config/ |
|
20 // |
|
21 // This file is intended to be stable, and relatively unchanging. |
|
22 // It should contain boilerplate code only - no compiler specific |
|
23 // code unless it is unavoidable - no changes unless unavoidable. |
|
24 |
|
25 #ifndef BOOST_CONFIG_SUFFIX_HPP |
|
26 #define BOOST_CONFIG_SUFFIX_HPP |
|
27 |
|
28 // |
|
29 // look for long long by looking for the appropriate macros in <limits.h>. |
|
30 // Note that we use limits.h rather than climits for maximal portability, |
|
31 // remember that since these just declare a bunch of macros, there should be |
|
32 // no namespace issues from this. |
|
33 // |
|
34 #if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_LONG_LONG) \ |
|
35 && !defined(BOOST_MSVC) && !defined(__BORLANDC__) |
|
36 # include <limits.h> |
|
37 # if (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX)) |
|
38 # define BOOST_HAS_LONG_LONG |
|
39 # else |
|
40 # define BOOST_NO_LONG_LONG |
|
41 # endif |
|
42 #endif |
|
43 |
|
44 // GCC 3.x will clean up all of those nasty macro definitions that |
|
45 // BOOST_NO_CTYPE_FUNCTIONS is intended to help work around, so undefine |
|
46 // it under GCC 3.x. |
|
47 #if defined(__GNUC__) && (__GNUC__ >= 3) && defined(BOOST_NO_CTYPE_FUNCTIONS) |
|
48 # undef BOOST_NO_CTYPE_FUNCTIONS |
|
49 #endif |
|
50 |
|
51 // |
|
52 // Assume any extensions are in namespace std:: unless stated otherwise: |
|
53 // |
|
54 # ifndef BOOST_STD_EXTENSION_NAMESPACE |
|
55 # define BOOST_STD_EXTENSION_NAMESPACE std |
|
56 # endif |
|
57 |
|
58 // |
|
59 // If cv-qualified specializations are not allowed, then neither are cv-void ones: |
|
60 // |
|
61 # if defined(BOOST_NO_CV_SPECIALIZATIONS) \ |
|
62 && !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) |
|
63 # define BOOST_NO_CV_VOID_SPECIALIZATIONS |
|
64 # endif |
|
65 |
|
66 // |
|
67 // If there is no numeric_limits template, then it can't have any compile time |
|
68 // constants either! |
|
69 // |
|
70 # if defined(BOOST_NO_LIMITS) \ |
|
71 && !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) |
|
72 # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS |
|
73 # define BOOST_NO_MS_INT64_NUMERIC_LIMITS |
|
74 # define BOOST_NO_LONG_LONG_NUMERIC_LIMITS |
|
75 # endif |
|
76 |
|
77 // |
|
78 // if there is no long long then there is no specialisation |
|
79 // for numeric_limits<long long> either: |
|
80 // |
|
81 #if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS) |
|
82 # define BOOST_NO_LONG_LONG_NUMERIC_LIMITS |
|
83 #endif |
|
84 |
|
85 // |
|
86 // if there is no __int64 then there is no specialisation |
|
87 // for numeric_limits<__int64> either: |
|
88 // |
|
89 #if !defined(BOOST_HAS_MS_INT64) && !defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS) |
|
90 # define BOOST_NO_MS_INT64_NUMERIC_LIMITS |
|
91 #endif |
|
92 |
|
93 // |
|
94 // if member templates are supported then so is the |
|
95 // VC6 subset of member templates: |
|
96 // |
|
97 # if !defined(BOOST_NO_MEMBER_TEMPLATES) \ |
|
98 && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) |
|
99 # define BOOST_MSVC6_MEMBER_TEMPLATES |
|
100 # endif |
|
101 |
|
102 // |
|
103 // Without partial specialization, can't test for partial specialisation bugs: |
|
104 // |
|
105 # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ |
|
106 && !defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) |
|
107 # define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG |
|
108 # endif |
|
109 |
|
110 // |
|
111 // Without partial specialization, we can't have array-type partial specialisations: |
|
112 // |
|
113 # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ |
|
114 && !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) |
|
115 # define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS |
|
116 # endif |
|
117 |
|
118 // |
|
119 // Without partial specialization, std::iterator_traits can't work: |
|
120 // |
|
121 # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ |
|
122 && !defined(BOOST_NO_STD_ITERATOR_TRAITS) |
|
123 # define BOOST_NO_STD_ITERATOR_TRAITS |
|
124 # endif |
|
125 |
|
126 // |
|
127 // Without partial specialization, partial |
|
128 // specialization with default args won't work either: |
|
129 // |
|
130 # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ |
|
131 && !defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS) |
|
132 # define BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS |
|
133 # endif |
|
134 |
|
135 // |
|
136 // Without member template support, we can't have template constructors |
|
137 // in the standard library either: |
|
138 // |
|
139 # if defined(BOOST_NO_MEMBER_TEMPLATES) \ |
|
140 && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \ |
|
141 && !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) |
|
142 # define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS |
|
143 # endif |
|
144 |
|
145 // |
|
146 // Without member template support, we can't have a conforming |
|
147 // std::allocator template either: |
|
148 // |
|
149 # if defined(BOOST_NO_MEMBER_TEMPLATES) \ |
|
150 && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \ |
|
151 && !defined(BOOST_NO_STD_ALLOCATOR) |
|
152 # define BOOST_NO_STD_ALLOCATOR |
|
153 # endif |
|
154 |
|
155 // |
|
156 // without ADL support then using declarations will break ADL as well: |
|
157 // |
|
158 #if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) |
|
159 # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL |
|
160 #endif |
|
161 |
|
162 // |
|
163 // Without typeid support we have no dynamic RTTI either: |
|
164 // |
|
165 #if defined(BOOST_NO_TYPEID) && !defined(BOOST_NO_RTTI) |
|
166 # define BOOST_NO_RTTI |
|
167 #endif |
|
168 |
|
169 // |
|
170 // If we have a standard allocator, then we have a partial one as well: |
|
171 // |
|
172 #if !defined(BOOST_NO_STD_ALLOCATOR) |
|
173 # define BOOST_HAS_PARTIAL_STD_ALLOCATOR |
|
174 #endif |
|
175 |
|
176 // |
|
177 // We can't have a working std::use_facet if there is no std::locale: |
|
178 // |
|
179 # if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_USE_FACET) |
|
180 # define BOOST_NO_STD_USE_FACET |
|
181 # endif |
|
182 |
|
183 // |
|
184 // We can't have a std::messages facet if there is no std::locale: |
|
185 // |
|
186 # if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_MESSAGES) |
|
187 # define BOOST_NO_STD_MESSAGES |
|
188 # endif |
|
189 |
|
190 // |
|
191 // We can't have a working std::wstreambuf if there is no std::locale: |
|
192 // |
|
193 # if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_WSTREAMBUF) |
|
194 # define BOOST_NO_STD_WSTREAMBUF |
|
195 # endif |
|
196 |
|
197 // |
|
198 // We can't have a <cwctype> if there is no <cwchar>: |
|
199 // |
|
200 # if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_CWCTYPE) |
|
201 # define BOOST_NO_CWCTYPE |
|
202 # endif |
|
203 |
|
204 // |
|
205 // We can't have a swprintf if there is no <cwchar>: |
|
206 // |
|
207 # if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_SWPRINTF) |
|
208 # define BOOST_NO_SWPRINTF |
|
209 # endif |
|
210 |
|
211 // |
|
212 // If Win32 support is turned off, then we must turn off |
|
213 // threading support also, unless there is some other |
|
214 // thread API enabled: |
|
215 // |
|
216 #if defined(BOOST_DISABLE_WIN32) && defined(_WIN32) \ |
|
217 && !defined(BOOST_DISABLE_THREADS) && !defined(BOOST_HAS_PTHREADS) |
|
218 # define BOOST_DISABLE_THREADS |
|
219 #endif |
|
220 |
|
221 // |
|
222 // Turn on threading support if the compiler thinks that it's in |
|
223 // multithreaded mode. We put this here because there are only a |
|
224 // limited number of macros that identify this (if there's any missing |
|
225 // from here then add to the appropriate compiler section): |
|
226 // |
|
227 #if (defined(__MT__) || defined(_MT) || defined(_REENTRANT) \ |
|
228 || defined(_PTHREADS) || defined(__APPLE__) || defined(__DragonFly__)) \ |
|
229 && !defined(BOOST_HAS_THREADS) |
|
230 # define BOOST_HAS_THREADS |
|
231 #endif |
|
232 |
|
233 // |
|
234 // Turn threading support off if BOOST_DISABLE_THREADS is defined: |
|
235 // |
|
236 #if defined(BOOST_DISABLE_THREADS) && defined(BOOST_HAS_THREADS) |
|
237 # undef BOOST_HAS_THREADS |
|
238 #endif |
|
239 |
|
240 // |
|
241 // Turn threading support off if we don't recognise the threading API: |
|
242 // |
|
243 #if defined(BOOST_HAS_THREADS) && !defined(BOOST_HAS_PTHREADS)\ |
|
244 && !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_BETHREADS)\ |
|
245 && !defined(BOOST_HAS_MPTASKS) |
|
246 # undef BOOST_HAS_THREADS |
|
247 #endif |
|
248 |
|
249 // |
|
250 // Turn threading detail macros off if we don't (want to) use threading |
|
251 // |
|
252 #ifndef BOOST_HAS_THREADS |
|
253 # undef BOOST_HAS_PTHREADS |
|
254 # undef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE |
|
255 # undef BOOST_HAS_PTHREAD_YIELD |
|
256 # undef BOOST_HAS_PTHREAD_DELAY_NP |
|
257 # undef BOOST_HAS_WINTHREADS |
|
258 # undef BOOST_HAS_BETHREADS |
|
259 # undef BOOST_HAS_MPTASKS |
|
260 #endif |
|
261 |
|
262 // |
|
263 // If the compiler claims to be C99 conformant, then it had better |
|
264 // have a <stdint.h>: |
|
265 // |
|
266 # if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) |
|
267 # define BOOST_HAS_STDINT_H |
|
268 # ifndef BOOST_HAS_LOG1P |
|
269 # define BOOST_HAS_LOG1P |
|
270 # endif |
|
271 # ifndef BOOST_HAS_EXPM1 |
|
272 # define BOOST_HAS_EXPM1 |
|
273 # endif |
|
274 # endif |
|
275 |
|
276 // |
|
277 // Define BOOST_NO_SLIST and BOOST_NO_HASH if required. |
|
278 // Note that this is for backwards compatibility only. |
|
279 // |
|
280 # if !defined(BOOST_HAS_SLIST) && !defined(BOOST_NO_SLIST) |
|
281 # define BOOST_NO_SLIST |
|
282 # endif |
|
283 |
|
284 # if !defined(BOOST_HAS_HASH) && !defined(BOOST_NO_HASH) |
|
285 # define BOOST_NO_HASH |
|
286 # endif |
|
287 |
|
288 // |
|
289 // Set BOOST_SLIST_HEADER if not set already: |
|
290 // |
|
291 #if defined(BOOST_HAS_SLIST) && !defined(BOOST_SLIST_HEADER) |
|
292 # define BOOST_SLIST_HEADER <slist> |
|
293 #endif |
|
294 |
|
295 // |
|
296 // Set BOOST_HASH_SET_HEADER if not set already: |
|
297 // |
|
298 #if defined(BOOST_HAS_HASH) && !defined(BOOST_HASH_SET_HEADER) |
|
299 # define BOOST_HASH_SET_HEADER <hash_set> |
|
300 #endif |
|
301 |
|
302 // |
|
303 // Set BOOST_HASH_MAP_HEADER if not set already: |
|
304 // |
|
305 #if defined(BOOST_HAS_HASH) && !defined(BOOST_HASH_MAP_HEADER) |
|
306 # define BOOST_HASH_MAP_HEADER <hash_map> |
|
307 #endif |
|
308 |
|
309 // BOOST_HAS_ABI_HEADERS |
|
310 // This macro gets set if we have headers that fix the ABI, |
|
311 // and prevent ODR violations when linking to external libraries: |
|
312 #if defined(BOOST_ABI_PREFIX) && defined(BOOST_ABI_SUFFIX) && !defined(BOOST_HAS_ABI_HEADERS) |
|
313 # define BOOST_HAS_ABI_HEADERS |
|
314 #endif |
|
315 |
|
316 #if defined(BOOST_HAS_ABI_HEADERS) && defined(BOOST_DISABLE_ABI_HEADERS) |
|
317 # undef BOOST_HAS_ABI_HEADERS |
|
318 #endif |
|
319 |
|
320 // BOOST_NO_STDC_NAMESPACE workaround --------------------------------------// |
|
321 // Because std::size_t usage is so common, even in boost headers which do not |
|
322 // otherwise use the C library, the <cstddef> workaround is included here so |
|
323 // that ugly workaround code need not appear in many other boost headers. |
|
324 // NOTE WELL: This is a workaround for non-conforming compilers; <cstddef> |
|
325 // must still be #included in the usual places so that <cstddef> inclusion |
|
326 // works as expected with standard conforming compilers. The resulting |
|
327 // double inclusion of <cstddef> is harmless. |
|
328 |
|
329 # ifdef BOOST_NO_STDC_NAMESPACE |
|
330 # include <cstddef> |
|
331 namespace std { using ::ptrdiff_t; using ::size_t; } |
|
332 # endif |
|
333 |
|
334 // Workaround for the unfortunate min/max macros defined by some platform headers |
|
335 |
|
336 #define BOOST_PREVENT_MACRO_SUBSTITUTION |
|
337 |
|
338 #ifndef BOOST_USING_STD_MIN |
|
339 # define BOOST_USING_STD_MIN() using std::min |
|
340 #endif |
|
341 |
|
342 #ifndef BOOST_USING_STD_MAX |
|
343 # define BOOST_USING_STD_MAX() using std::max |
|
344 #endif |
|
345 |
|
346 // BOOST_NO_STD_MIN_MAX workaround -----------------------------------------// |
|
347 |
|
348 # ifdef BOOST_NO_STD_MIN_MAX |
|
349 |
|
350 namespace std { |
|
351 template <class _Tp> |
|
352 inline const _Tp& min BOOST_PREVENT_MACRO_SUBSTITUTION (const _Tp& __a, const _Tp& __b) { |
|
353 return __b < __a ? __b : __a; |
|
354 } |
|
355 template <class _Tp> |
|
356 inline const _Tp& max BOOST_PREVENT_MACRO_SUBSTITUTION (const _Tp& __a, const _Tp& __b) { |
|
357 return __a < __b ? __b : __a; |
|
358 } |
|
359 } |
|
360 |
|
361 # endif |
|
362 |
|
363 // BOOST_STATIC_CONSTANT workaround --------------------------------------- // |
|
364 // On compilers which don't allow in-class initialization of static integral |
|
365 // constant members, we must use enums as a workaround if we want the constants |
|
366 // to be available at compile-time. This macro gives us a convenient way to |
|
367 // declare such constants. |
|
368 |
|
369 # ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION |
|
370 # define BOOST_STATIC_CONSTANT(type, assignment) enum { assignment } |
|
371 # else |
|
372 # define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment |
|
373 # endif |
|
374 |
|
375 // BOOST_USE_FACET / HAS_FACET workaround ----------------------------------// |
|
376 // When the standard library does not have a conforming std::use_facet there |
|
377 // are various workarounds available, but they differ from library to library. |
|
378 // The same problem occurs with has_facet. |
|
379 // These macros provide a consistent way to access a locale's facets. |
|
380 // Usage: |
|
381 // replace |
|
382 // std::use_facet<Type>(loc); |
|
383 // with |
|
384 // BOOST_USE_FACET(Type, loc); |
|
385 // Note do not add a std:: prefix to the front of BOOST_USE_FACET! |
|
386 // Use for BOOST_HAS_FACET is analogous. |
|
387 |
|
388 #if defined(BOOST_NO_STD_USE_FACET) |
|
389 # ifdef BOOST_HAS_TWO_ARG_USE_FACET |
|
390 # define BOOST_USE_FACET(Type, loc) std::use_facet(loc, static_cast<Type*>(0)) |
|
391 # define BOOST_HAS_FACET(Type, loc) std::has_facet(loc, static_cast<Type*>(0)) |
|
392 # elif defined(BOOST_HAS_MACRO_USE_FACET) |
|
393 # define BOOST_USE_FACET(Type, loc) std::_USE(loc, Type) |
|
394 # define BOOST_HAS_FACET(Type, loc) std::_HAS(loc, Type) |
|
395 # elif defined(BOOST_HAS_STLP_USE_FACET) |
|
396 # define BOOST_USE_FACET(Type, loc) (*std::_Use_facet<Type >(loc)) |
|
397 # define BOOST_HAS_FACET(Type, loc) std::has_facet< Type >(loc) |
|
398 # endif |
|
399 #else |
|
400 # define BOOST_USE_FACET(Type, loc) std::use_facet< Type >(loc) |
|
401 # define BOOST_HAS_FACET(Type, loc) std::has_facet< Type >(loc) |
|
402 #endif |
|
403 |
|
404 // BOOST_NESTED_TEMPLATE workaround ------------------------------------------// |
|
405 // Member templates are supported by some compilers even though they can't use |
|
406 // the A::template member<U> syntax, as a workaround replace: |
|
407 // |
|
408 // typedef typename A::template rebind<U> binder; |
|
409 // |
|
410 // with: |
|
411 // |
|
412 // typedef typename A::BOOST_NESTED_TEMPLATE rebind<U> binder; |
|
413 |
|
414 #ifndef BOOST_NO_MEMBER_TEMPLATE_KEYWORD |
|
415 # define BOOST_NESTED_TEMPLATE template |
|
416 #else |
|
417 # define BOOST_NESTED_TEMPLATE |
|
418 #endif |
|
419 |
|
420 // BOOST_UNREACHABLE_RETURN(x) workaround -------------------------------------// |
|
421 // Normally evaluates to nothing, unless BOOST_NO_UNREACHABLE_RETURN_DETECTION |
|
422 // is defined, in which case it evaluates to return x; Use when you have a return |
|
423 // statement that can never be reached. |
|
424 |
|
425 #ifdef BOOST_NO_UNREACHABLE_RETURN_DETECTION |
|
426 # define BOOST_UNREACHABLE_RETURN(x) return x; |
|
427 #else |
|
428 # define BOOST_UNREACHABLE_RETURN(x) |
|
429 #endif |
|
430 |
|
431 // BOOST_DEDUCED_TYPENAME workaround ------------------------------------------// |
|
432 // |
|
433 // Some compilers don't support the use of `typename' for dependent |
|
434 // types in deduced contexts, e.g. |
|
435 // |
|
436 // template <class T> void f(T, typename T::type); |
|
437 // ^^^^^^^^ |
|
438 // Replace these declarations with: |
|
439 // |
|
440 // template <class T> void f(T, BOOST_DEDUCED_TYPENAME T::type); |
|
441 |
|
442 #ifndef BOOST_NO_DEDUCED_TYPENAME |
|
443 # define BOOST_DEDUCED_TYPENAME typename |
|
444 #else |
|
445 # define BOOST_DEDUCED_TYPENAME |
|
446 #endif |
|
447 |
|
448 #ifndef BOOST_NO_TYPENAME_WITH_CTOR |
|
449 # define BOOST_CTOR_TYPENAME typename |
|
450 #else |
|
451 # define BOOST_CTOR_TYPENAME |
|
452 #endif |
|
453 |
|
454 // long long workaround ------------------------------------------// |
|
455 // On gcc (and maybe other compilers?) long long is alway supported |
|
456 // but it's use may generate either warnings (with -ansi), or errors |
|
457 // (with -pedantic -ansi) unless it's use is prefixed by __extension__ |
|
458 // |
|
459 #if defined(BOOST_HAS_LONG_LONG) |
|
460 namespace boost{ |
|
461 # ifdef __GNUC__ |
|
462 __extension__ typedef long long long_long_type; |
|
463 __extension__ typedef unsigned long long ulong_long_type; |
|
464 # else |
|
465 typedef long long long_long_type; |
|
466 typedef unsigned long long ulong_long_type; |
|
467 # endif |
|
468 } |
|
469 #endif |
|
470 |
|
471 // BOOST_[APPEND_]EXPLICIT_TEMPLATE_[NON_]TYPE macros --------------------------// |
|
472 // |
|
473 // Some compilers have problems with function templates whose template |
|
474 // parameters don't appear in the function parameter list (basically |
|
475 // they just link one instantiation of the template in the final |
|
476 // executable). These macros provide a uniform way to cope with the |
|
477 // problem with no effects on the calling syntax. |
|
478 |
|
479 // Example: |
|
480 // |
|
481 // #include <iostream> |
|
482 // #include <ostream> |
|
483 // #include <typeinfo> |
|
484 // |
|
485 // template <int n> |
|
486 // void f() { std::cout << n << ' '; } |
|
487 // |
|
488 // template <typename T> |
|
489 // void g() { std::cout << typeid(T).name() << ' '; } |
|
490 // |
|
491 // int main() { |
|
492 // f<1>(); |
|
493 // f<2>(); |
|
494 // |
|
495 // g<int>(); |
|
496 // g<double>(); |
|
497 // } |
|
498 // |
|
499 // With VC++ 6.0 the output is: |
|
500 // |
|
501 // 2 2 double double |
|
502 // |
|
503 // To fix it, write |
|
504 // |
|
505 // template <int n> |
|
506 // void f(BOOST_EXPLICIT_TEMPLATE_NON_TYPE(int, n)) { ... } |
|
507 // |
|
508 // template <typename T> |
|
509 // void g(BOOST_EXPLICIT_TEMPLATE_TYPE(T)) { ... } |
|
510 // |
|
511 |
|
512 |
|
513 #if defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS |
|
514 |
|
515 # include "boost/type.hpp" |
|
516 # include "boost/non_type.hpp" |
|
517 |
|
518 # define BOOST_EXPLICIT_TEMPLATE_TYPE(t) boost::type<t>* = 0 |
|
519 # define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) boost::type<t>* |
|
520 # define BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) boost::non_type<t, v>* = 0 |
|
521 # define BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) boost::non_type<t, v>* |
|
522 |
|
523 # define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t) \ |
|
524 , BOOST_EXPLICIT_TEMPLATE_TYPE(t) |
|
525 # define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) \ |
|
526 , BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) |
|
527 # define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) \ |
|
528 , BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) |
|
529 # define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) \ |
|
530 , BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) |
|
531 |
|
532 #else |
|
533 |
|
534 // no workaround needed: expand to nothing |
|
535 |
|
536 # define BOOST_EXPLICIT_TEMPLATE_TYPE(t) |
|
537 # define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) |
|
538 # define BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) |
|
539 # define BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) |
|
540 |
|
541 # define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t) |
|
542 # define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) |
|
543 # define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) |
|
544 # define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) |
|
545 |
|
546 |
|
547 #endif // defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS |
|
548 |
|
549 |
|
550 // ---------------------------------------------------------------------------// |
|
551 |
|
552 // |
|
553 // Helper macro BOOST_STRINGIZE: |
|
554 // Converts the parameter X to a string after macro replacement |
|
555 // on X has been performed. |
|
556 // |
|
557 #define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X) |
|
558 #define BOOST_DO_STRINGIZE(X) #X |
|
559 |
|
560 // |
|
561 // Helper macro BOOST_JOIN: |
|
562 // The following piece of macro magic joins the two |
|
563 // arguments together, even when one of the arguments is |
|
564 // itself a macro (see 16.3.1 in C++ standard). The key |
|
565 // is that macro expansion of macro arguments does not |
|
566 // occur in BOOST_DO_JOIN2 but does in BOOST_DO_JOIN. |
|
567 // |
|
568 #define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y ) |
|
569 #define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y) |
|
570 #define BOOST_DO_JOIN2( X, Y ) X##Y |
|
571 |
|
572 // |
|
573 // Set some default values for compiler/library/platform names. |
|
574 // These are for debugging config setup only: |
|
575 // |
|
576 # ifndef BOOST_COMPILER |
|
577 # define BOOST_COMPILER "Unknown ISO C++ Compiler" |
|
578 # endif |
|
579 # ifndef BOOST_STDLIB |
|
580 # define BOOST_STDLIB "Unknown ISO standard library" |
|
581 # endif |
|
582 # ifndef BOOST_PLATFORM |
|
583 # if defined(unix) || defined(__unix) || defined(_XOPEN_SOURCE) \ |
|
584 || defined(_POSIX_SOURCE) |
|
585 # define BOOST_PLATFORM "Generic Unix" |
|
586 # else |
|
587 # define BOOST_PLATFORM "Unknown" |
|
588 # endif |
|
589 # endif |
|
590 |
|
591 #endif |
|
592 |
|
593 |