1 // Boost config.hpp configuration header file ------------------------------//
3 // (C) Copyright Boost.org 1999. Permission to copy, use, modify, sell and
4 // distribute this software is granted provided this copyright notice appears
5 // in all copies. This software is provided "as is" without express or implied
6 // warranty, and with no claim as to its suitability for any purpose.
8 // See http://www.boost.org for most recent version.
10 // Boost config.hpp policy and rationale documentation has been moved to
11 // http://www.boost.org/libs/config
13 // Revision History (excluding minor changes for specific compilers)
14 // 20 Jan 01 BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS moved here from
15 // cast.hpp. Added missing BOOST_NO_STRINGSTREAM which some
16 // boost code seemed to depend on. (Dave Abrahams)
17 // 13 Jan 01 SGI MIPSpro and Compaq Tru64 Unix compiler support added
19 // 13 Jan 01 BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP (Jens Maurer)
20 // 17 Nov 00 BOOST_NO_AUTO_PTR (John Maddock)
21 // 4 Oct 00 BOOST_NO_STD_MIN_MAX (Jeremy Siek)
22 // 29 Sep 00 BOOST_NO_INTEGRAL_INT64_T (Jens Maurer)
23 // 25 Sep 00 BOOST_NO_STD_ALLOCATOR (Jeremy Siek)
24 // 18 SEP 00 BOOST_NO_SLIST, BOOST_NO_HASH,
25 // BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
26 // BOOST_NO_LIMITS (Jeremy Siek)
27 // 1 Sep 00 BOOST_NO_PRIVATE_IN_AGGREGATE added. (Mark Rodgers)
28 // 23 Jul 00 Fixed spelling of BOOST_NO_INCLASS_MEMBER_INITIALIZATION in
29 // comment (Dave Abrahams).
30 // 10 Jul 00 BOOST_NO_POINTER_TO_MEMBER_CONST added (Mark Rodgers)
31 // 26 Jun 00 BOOST_NO_STD_ITERATOR, BOOST_MSVC_STD_ITERATOR,
32 // BOOST_NO_STD_ITERATOR_TRAITS, BOOST_NO_USING_TEMPLATE,
33 // added (Jeremy Siek)
34 // 20 Jun 00 BOOST_MSVC added (Aleksey Gurtovoy)
35 // 14 Jun 00 BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS (Jens M.)
36 // 22 Mar 00 BOOST_MSVC6_MEMBER_TEMPLATES added (Dave Abrahams)
37 // 18 Feb 00 BOOST_NO_INCLASS_MEMBER_INITIALIZATION added (Jens Maurer)
38 // 26 Jan 00 Borland compiler support added (John Maddock)
39 // 26 Jan 00 Sun compiler support added (Jörg Schaible)
40 // 30 Dec 99 BOOST_NMEMBER_TEMPLATES compatibility moved here from
41 // smart_ptr.hpp. (Dave Abrahams)
42 // 15 Nov 99 BOOST_NO_OPERATORS_IN_NAMESPACE,
43 // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION added (Beman Dawes)
44 // 11 Oct 99 BOOST_NO_STDC_NAMESPACE refined; <cstddef> supplied
45 // 29 Sep 99 BOOST_NO_STDC_NAMESPACE added (Ed Brey)
46 // 24 Sep 99 BOOST_DECL added (Ed Brey)
47 // 10 Aug 99 Endedness flags added, GNU CC support added
48 // 22 Jul 99 Initial version
51 #ifndef BOOST_CONFIG_HPP
52 #define BOOST_CONFIG_HPP
54 // Conformance Flag Macros -------------------------------------------------//
56 // Conformance flag macros should identify the absence of C++ Standard
57 // conformance rather than its presence. This ensures that standard conforming
58 // compilers do not require a lot of configuration flag macros. It places the
59 // burden where it should be, on non-conforming compilers. In the future,
60 // hopefully, less rather than more conformance flags will have to be defined.
62 // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP: Compiler does not implement
63 // argument-dependent lookup (also named Koenig lookup); see std::3.4.2
64 // [basic.koenig.lookup]
66 // BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS: Template value
67 // parameters cannot have a dependent type, for example
68 // "template<class T, typename T::type value> class X { ... };"
70 // BOOST_NO_INCLASS_MEMBER_INITIALIZATION: Compiler violates std::9.4.2/4.
72 // BOOST_NO_INT64_T: <boost/cstdint.hpp> does not support 64-bit integer
73 // types. (Set by <boost/cstdint.hpp> rather than <boost/config.hpp>).
75 // BOOST_NO_INTEGRAL_INT64_T: int64_t as defined by <boost/cstdint.hpp> is
76 // not an integral type.
78 // BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS: constants such as
79 // numeric_limits<T>::is_signed are not available for use at compile-time.
81 // BOOST_NO_MEMBER_TEMPLATES: Member template functions not fully supported.
82 // Also see BOOST_MSVC6_MEMBER_TEMPLATES in the Compiler Control section below.
84 // BOOST_NO_MEMBER_TEMPLATE_FRIENDS: Member template friend syntax
85 // ("template<class P> friend class frd;") described in the C++ Standard,
86 // 14.5.3, not supported.
88 // BOOST_NO_OPERATORS_IN_NAMESPACE: Compiler requires inherited operator
89 // friend functions to be defined at namespace scope, then using'ed to boost.
90 // Probably GCC specific. See boost/operators.hpp for example.
92 // BOOST_NO_POINTER_TO_MEMBER_CONST: The compiler does not correctly handle
93 // pointers to const member functions, preventing use of these in overloaded
94 // function templates. See boost/functional.hpp for example.
96 // BOOST_NO_PRIVATE_IN_AGGREGATE: The compiler misreads 8.5.1, treating classes
97 // as non-aggregate if they contain private or protected member functions.
99 // BOOST_NO_STD_ITERATOR: The C++ implementation fails to provide the
100 // std::iterator class.
102 // BOOST_NO_STD_ITERATOR_TRAITS: The compiler does not provide a standard
103 // compliant implementation of std::iterator_traits. Note that
104 // the compiler may still have a non-standard implementation.
106 // BOOST_NO_STDC_NAMESPACE: The contents of C++ standard headers for C library
107 // functions (the <c...> headers) have not been placed in namespace std.
108 // Because the use of std::size_t is so common, a specific workaround for
109 // <cstddef> (and thus std::size_t) is provided in this header (see below).
110 // For other <c...> headers, a workaround must be provided in the boost header:
112 // #include <cstdlib> // for abs
113 // #ifdef BOOST_NO_STDC_NAMESPACE
114 // namespace std { using ::abs; }
117 // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION. Class template partial
118 // specialization (14.5.4 [temp.class.spec]) not supported.
120 // BOOST_NO_USING_TEMPLATE: The compiler will not accept a using declaration
121 // that imports a template from the global namespace into a named namespace.
122 // Probably Borland specific.
124 // BOOST_NO_AUTO_PTR: If the compiler / library supplies non-standard or broken
127 // Compiler Control or Information Macros ----------------------------------//
129 // Compilers often supply features outside of the C++ Standard which need to be
130 // controlled or detected. As usual, reasonable default behavior should occur
131 // if any of these macros are not defined.
133 // BOOST_DECL: Certain compilers for Microsoft operating systems require
134 // non-standard class and function decoration if dynamic load library linking
135 // is desired. BOOST_DECL supplies that decoration. Boost does not require
136 // use of BOOST_DECL - it is non-standard and to be avoided if practical to do
137 // so. Even compilers requiring it for DLL's only require it in certain cases.
139 // BOOST_DECL_EXPORTS: User defined, usually via command line or IDE,
140 // it causes BOOST_DECL to be defined as __declspec(dllexport).
142 // BOOST_DECL_IMPORTS: User defined, usually via command line or IDE,
143 // it causes BOOST_DECL to be defined as __declspec(dllimport).
145 // If neither BOOST_DECL_EXPORTS nor BOOST_DECL_IMPORTS is defined, or if
146 // the compiler does not require __declspec() decoration, BOOST_DECL is
147 // defined as a null string.
149 // BOOST_MSVC6_MEMBER_TEMPLATES: Microsoft Visual C++ 6.0 has enough member
150 // template idiosyncrasies (being polite) that BOOST_NO_MEMBER_TEMPLATES is
151 // defined for this compiler. BOOST_MSVC6_MEMBER_TEMPLATES is defined to allow
152 // compiler specific workarounds.
154 // BOOST_MSVC: defined as _MSC_VER for the Microsoft compiler only. In general,
155 // boost headers should test for a specific conformance flag macro (for
156 // example, BOOST_NO_MEMBER_TEMPLATE_FRIENDS) rather than a specific compiler.
157 // VC++ is a special case, however, since many libraries try to support it yet
158 // it has so many conformance issues that sometimes it is just easier to test
159 // for it directly. On the other hand, the obvious way to do this doesn't work,
160 // as many non-Microsoft compilers define _MSC_VER. Thus BOOST_MSVC.
162 // BOOST_MSVC_STD_ITERATOR: Microsoft's broken version of std::iterator
165 // BOOST_SYSTEM_HAS_STDINT_H: There are no 1998 C++ Standard headers <stdint.h>
166 // or <cstdint>, although the 1999 C Standard does include <stdint.h>.
167 // If <stdint.h> is present, <boost/stdint.h> can make good use of it,
168 // so a flag is supplied (signalling presence; thus the default is not
169 // present, conforming to the current C++ standard).
171 // BOOST_NO_SLIST: The C++ implementation does not provide the slist class.
173 // BOOST_NO_STRINGSTREAM: The C++ implementation does not provide the <sstream> header.
175 // BOOST_NO_HASH: The C++ implementation does not provide the hash_set
176 // or hash_map classes.
178 // BOOST_STD_EXTENSION_NAMESPACE: The name of the namespace in which the slist,
179 // hash_set and/or hash_map templates are defined in this implementation (if any).
181 // BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS: The standard library does not provide
182 // templated iterator constructors for its containers.
184 // BOOST_NO_LIMITS: The C++ implementation does not provide the <limits> header.
186 // BOOST_NO_INTRINSIC_WCHAR_T: The C++ implementation does not provide wchar_t,
187 // or it is really a synonym for another integral type. Use this symbol to
188 // decide whether it is appropriate to explicitly specialize a template on
189 // wchar_t if there is already a specialization for other integer types.
191 // BOOST_NO_STD_ALLOCATOR: The C++ standard library does not provide
192 // a standards conforming std::allocator.
194 // BOOST_NO_STD_MIN_MAX: The C++ standard library does not provide
195 // the min() and max() template functions that should be in <algorithm>.
197 // Compilers are listed in alphabetic order (except VC++ last - see below)---//
199 // GNU CC (also known as GCC and G++) --------------------------------------//
201 # if defined __GNUC__
202 # if __GNUC__ == 2 && __GNUC_MINOR__ == 91
203 // egcs 1.1 won't parse smart_ptr.hpp without this:
204 # define BOOST_NO_AUTO_PTR
206 # if __GNUC__ == 2 && __GNUC_MINOR__ <= 95
207 # include <iterator> // not sure this is the right way to do this -JGS
208 # if !defined(_CXXRT_STD) && !defined(__SGI_STL) // need to ask Dietmar about this -JGS
209 # define BOOST_NO_STD_ITERATOR
210 # define BOOST_NO_LIMITS
212 # if !defined(_CXXRT_STD) && !defined(__SGI_STL_OWN_IOSTREAMS)
213 # define BOOST_NO_STRINGSTREAM
215 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
216 # define BOOST_NO_OPERATORS_IN_NAMESPACE
218 # if __GNUC__ == 2 && __GNUC_MINOR__ <= 8
219 # define BOOST_NO_MEMBER_TEMPLATES
221 # if (__GNUC__ == 2 && __GNUC_MINOR__ > 95) || __GNUC__ > 2
224 # if defined(__GLIBCPP__)
225 // The new GNU C++ library has slist, hash_map, hash_set headers
226 // in <ext/*>, but client code assumes they're in <*> --- Jens M.
227 # define BOOST_NO_SLIST
228 # define BOOST_NO_HASH
232 // Kai C++ ------------------------------------------------------------------//
235 # define BOOST_NO_SLIST
236 # define BOOST_NO_HASH
238 # if __KCC_VERSION <= 4001
239 // at least on Sun, the contents of <cwchar> is not in namespace std
240 # define BOOST_NO_STDC_NAMESPACE
243 // SGI MIPSpro C++ --------------------------------------------------------
247 # if defined(__EDG_VERSION__) && __EDG_VERSION__ <= 240
248 # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
251 // Compaq Tru64 Unix cxx ---------------------------------------------------
253 #elif defined __DECCXX
255 # if defined(__EDG_VERSION__) && __EDG_VERSION__ <= 240
256 # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
259 // Greenhills C++ -----------------------------------------------------------//
262 # define BOOST_NO_SLIST
263 # define BOOST_NO_HASH
265 // Borland ------------------------------------------------------------------//
267 #elif defined __BORLANDC__
268 # define BOOST_NO_SLIST
269 # define BOOST_NO_HASH
270 # if __BORLANDC__ <= 0x0551
271 # define BOOST_NO_INTEGRAL_INT64_T
272 # define BOOST_NO_PRIVATE_IN_AGGREGATE
274 # if __BORLANDC__ <= 0x0550
275 // Borland C++ Builder 4 and 5:
276 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
277 # define BOOST_NO_USING_TEMPLATE
278 # if __BORLANDC__ == 0x0550
279 // Borland C++ Builder 5, command-line compiler 5.5:
280 # define BOOST_NO_OPERATORS_IN_NAMESPACE
283 # if defined BOOST_DECL_EXPORTS
284 # if defined BOOST_DECL_IMPORTS
285 # error Not valid to define both BOOST_DECL_EXPORTS and BOOST_DECL_IMPORTS
287 # define BOOST_DECL __declspec(dllexport)
288 # elif defined BOOST_DECL_IMPORTS
289 # define BOOST_DECL __declspec(dllimport)
294 // Intel -------------------------------------------------------------------//
297 # include <iterator> // not sure this is the right way to do this -JGS
298 # if __SGI_STL_PORT >= 0x400 || __SGI_STL_PORT >= 0x321 && defined(__STL_USE_NAMESPACES)
299 // a perfectly good implementation of std::iterator is supplied
300 # elif defined(__SGI_STL_ITERATOR)
301 # define BOOST_NO_STD_ITERATOR // No std::iterator in this case
302 # else // assume using dinkumware's STL that comes with VC++ 6.0
303 # define BOOST_MSVC_STD_ITERATOR
304 # define BOOST_NO_STD_ITERATOR_TRAITS
305 # define BOOST_NO_STDC_NAMESPACE
306 # define BOOST_NO_SLIST
307 # define BOOST_NO_HASH
308 # define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
309 # define BOOST_NO_STD_ALLOCATOR
310 # define BOOST_NO_STD_MIN_MAX
314 // Metrowerks CodeWarrior --------------------------------------------------//
316 # elif defined __MWERKS__
317 # if __MWERKS__ <= 0x4000
318 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
320 # if __MWERKS__ <= 0x2301
321 # define BOOST_NO_POINTER_TO_MEMBER_CONST
323 # if __MWERKS__ >= 0x2300
324 # define BOOST_SYSTEM_HAS_STDINT_H
326 # if defined BOOST_DECL_EXPORTS
327 # if defined BOOST_DECL_IMPORTS
328 # error Not valid to define both BOOST_DECL_EXPORTS and BOOST_DECL_IMPORTS
330 # define BOOST_DECL __declspec(dllexport)
331 # elif defined BOOST_DECL_IMPORTS
332 # define BOOST_DECL __declspec(dllimport)
337 # define BOOST_STD_EXTENSION_NAMESPACE Metrowerks
339 // Sun Workshop Compiler C++ ------------------------------------------------//
341 # elif defined __SUNPRO_CC
342 # if __SUNPRO_CC <= 0x520
343 # define BOOST_NO_SLIST
344 # define BOOST_NO_HASH
345 # define BOOST_NO_STD_ITERATOR_TRAITS
347 # if __SUNPRO_CC <= 0x500
348 # define BOOST_NO_MEMBER_TEMPLATES
349 # define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
352 // Microsoft Visual C++ (excluding Intel/EDG front end) --------------------//
354 // Must remain the last #elif since some other vendors (Metrowerks, for
355 // example) also #define _MSC_VER
357 # elif defined _MSC_VER
358 # define BOOST_MSVC _MSC_VER
360 // turn off the warnings before we #include anything
361 # pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info
362 # pragma warning( disable : 4503 ) // warning: decorated name length exceeded
364 # if _MSC_VER <= 1200 // 1200 == VC++ 6.0
365 # define BOOST_NO_INCLASS_MEMBER_INITIALIZATION
366 # define BOOST_NO_PRIVATE_IN_AGGREGATE
367 # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
369 # define BOOST_NO_INTEGRAL_INT64_T
370 # define BOOST_NO_INTRINSIC_WCHAR_T
372 // VC++ 6.0 has member templates but they have numerous problems including
373 // cases of silent failure, so for safety we define:
374 # define BOOST_NO_MEMBER_TEMPLATES
375 // For VC++ experts wishing to attempt workarounds, we define:
376 # define BOOST_MSVC6_MEMBER_TEMPLATES
378 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
379 # define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
380 # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
382 # include <iterator> // not sure this is the right way to do this -JGS
383 # if __SGI_STL_PORT >= 0x400 || __SGI_STL_PORT >= 0x321 && defined(__STL_USE_NAMESPACES)
384 // a perfectly good implementation of std::iterator is supplied
385 # elif defined(__SGI_STL_ITERATOR)
386 # define BOOST_NO_STD_ITERATOR // No std::iterator in this case
388 # define BOOST_MSVC_STD_ITERATOR 1
389 # define BOOST_NO_SLIST
390 # define BOOST_NO_HASH
391 # define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
392 # define BOOST_NO_STD_ALLOCATOR
394 // Updated Dinkum library defines this, and provides
395 // its own min and max definitions.
396 # define BOOST_NO_STD_MIN_MAX
401 // avoid spurious NOMINMAX redefinition warning
405 # define BOOST_NO_STD_ITERATOR_TRAITS
408 // Make sure at least one standard library header is included so that library
409 // implementation detection will work, even if no standard headers have been
410 // included in front of a boost header. (Ed Brey 5 Jun 00)
413 // Determine if the standard library implementation is already pulling names
414 // into std. STLport defines the following if so. (Ed Brey 5 Jun 00)
415 # if !defined( __STL_IMPORT_VENDOR_CSTD ) || defined( __STL_NO_CSTD_FUNCTION_IMPORTS )
416 # define BOOST_NO_STDC_NAMESPACE
421 # if defined BOOST_DECL_EXPORTS
422 # if defined BOOST_DECL_IMPORTS
423 # error Not valid to define both BOOST_DECL_EXPORTS and BOOST_DECL_IMPORTS
425 # define BOOST_DECL __declspec(dllexport)
426 # elif defined BOOST_DECL_IMPORTS
427 # define BOOST_DECL __declspec(dllimport)
432 # endif // Microsoft (excluding Intel/EDG frontend)
435 # define BOOST_DECL // default for compilers not needing this decoration.
438 // end of compiler specific portion ----------------------------------------//
440 #if defined(BOOST_NO_LIMITS) || \
441 (defined(_RWSTD_VER) && _RWSTD_VER < 0x0203) || \
442 (defined(__SGI_STL_PORT) && __SGI_STL_PORT <= 0x410 && __STL_STATIC_CONST_INIT_BUG)
443 // STLPort 4.0 doesn't define the static constants in numeric_limits<> so that they
444 // can be used at compile time if the compiler bug indicated by
445 // __STL_STATIC_CONST_INIT_BUG is present.
447 // Rogue wave STL (C++ Builder) also has broken numeric_limits
448 // with default template defining members out of line.
449 // However, Compaq C++ also uses RogueWave (version 2.03) and it's ok.
450 # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
453 #ifndef BOOST_STD_EXTENSION_NAMESPACE
454 # define BOOST_STD_EXTENSION_NAMESPACE std
457 // Check for old name "BOOST_NMEMBER_TEMPLATES" for compatibility -----------//
458 // Don't use BOOST_NMEMBER_TEMPLATES. It is deprecated and will be removed soon.
459 #if defined( BOOST_NMEMBER_TEMPLATES ) && !defined( BOOST_NO_MEMBER_TEMPLATES )
460 #define BOOST_NO_MEMBER_TEMPLATES
463 // BOOST_NO_STDC_NAMESPACE workaround --------------------------------------//
465 // Because std::size_t usage is so common, even in boost headers which do not
466 // otherwise use the C library, the <cstddef> workaround is included here so
467 // that ugly workaround code need not appear in many other boost headers.
468 // NOTE WELL: This is a workaround for non-conforming compilers; <cstddef>
469 // must still be #included in the usual places so that <cstddef> inclusion
470 // works as expected with standard conforming compilers. The resulting
471 // double inclusion of <cstddef> is harmless.
473 # ifdef BOOST_NO_STDC_NAMESPACE
475 namespace std { using ::ptrdiff_t; using ::size_t; }
476 // using ::wchar_t; removed since wchar_t is a C++ built-in type (Ed Brey)
479 #ifdef BOOST_NO_STD_MIN_MAX
482 inline const _Tp& min(const _Tp& __a, const _Tp& __b) {
483 return __b < __a ? __b : __a;
486 inline const _Tp& max(const _Tp& __a, const _Tp& __b) {
487 return __a < __b ? __b : __a;
490 inline long min(long __a, long __b) {
491 return __b < __a ? __b : __a;
493 inline long max(long __a, long __b) {
494 return __a < __b ? __b : __a;
500 #endif // BOOST_CONFIG_HPP