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