]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/config/doc/macro_reference.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / config / doc / macro_reference.qbk
CommitLineData
7c673cae
FG
1[/
2 Boost.Config
3
4 Copyright (c) 2001 Beman Dawes
5 Copyright (c) 2001 Vesa Karvonen
6 Copyright (c) 2001 John Maddock
7
8 Distributed under the Boost Software License, Version 1.0.
9 (See accompanying file LICENSE_1_0.txt or copy at
10 http://www.boost.org/LICENSE_1_0.txt)
11]
12
13
14
15[section Boost Macro Reference]
16
17[#config_defects]
18
19[section Macros that describe C++03 defects]
20
21The following macros all describe features that are required by the C++03 standard,
22if one of the following macros is defined, then it represents a defect in the
23compiler's conformance with the 2003 standard.
24
25
26[table
27[[Macro ][Section ][ Description ]]
28
29
30[[`BOOST_BCB_PARTIAL_SPECIALIZATION_BUG`][Compiler][
31The compiler exhibits certain partial specialisation bug - probably Borland
32C++ Builder specific.
33]]
34[[`BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL`][Compiler][
35Argument dependent lookup fails if there is a using declaration for the
36symbol being looked up in the current scope. For example, using
37`boost::get_pointer`; prevents ADL from finding overloads of `get_pointer`
38in namespaces nested inside boost (but not elsewhere). Probably
39Borland specific.
40]]
41[[`BOOST_NO_ADL_BARRIER`][Compiler][
42The compiler locates and searches namespaces that it should /*not*/ in fact
43search when performing argument dependent lookup.
44]]
45[[`BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP`][Compiler][
46Compiler does not implement argument-dependent lookup (also named
47Koenig lookup); see std::3.4.2 \[basic.koenig.lookup\]
48]]
49[[`BOOST_NO_AUTO_PTR`][Standard library][
50If the compiler / library supplies non-standard or broken `std::auto_ptr`.
51]]
52[[`BOOST_NO_COMPLETE_VALUE_INITIALIZATION`][Compiler][
53Compiler has not completely implemented value-initialization.
54See also [@../../../utility/value_init.htm#compiler_issues The Utility\/Value Init docs]
55]]
56[[`BOOST_NO_CTYPE_FUNCTIONS`][Platform][
57The Platform does not provide functions for the character-classifying
58operations `<ctype.h>` and `<cctype>`, only macros.
59]]
60[[`BOOST_NO_CV_SPECIALIZATIONS`][Compiler][
61If template specialisations for cv-qualified types conflict with a
62specialisation for a cv-unqualififed type.
63]]
64[[`BOOST_NO_CV_VOID_SPECIALIZATIONS`][Compiler][
65If template specialisations for cv-void types conflict with a specialisation
66for void.
67]]
68[[`BOOST_NO_CWCHAR`][Platform][
69The Platform does not provide `<wchar.h>` and `<cwchar>`.
70]]
71[[`BOOST_NO_CWCTYPE`][Platform][
72The Platform does not provide `<wctype.h>` and `<cwctype>`.
73]]
74[[`BOOST_NO_FENV_H`][Platform, Standard library][
75The C standard library doesn't provide `<fenv.h>`. [@../../../../boost/detail/fenv.hpp
76`<boost/detail/fenv.hpp>`] should be included instead of `<fenv.h>` for maximum
77portability on platforms which do provide `<fenv.h>`.
78]]
79[[`BOOST_NO_DEPENDENT_NESTED_DERIVATIONS`][Compiler][
80The compiler fails to compile a nested class that has a dependent base class:
81``
82template<typename T>
83struct foo : {
84 template<typename U>
85 struct bar : public U {};
86``
87};
88]]
89[[`BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS`][Compiler][
90Template value parameters cannot have a dependent type, for example:
91``
92template<class T, typename T::type value>
93class X { ... };
94``
95]]
96[[`BOOST_NO_EXCEPTION_STD_NAMESPACE`][Standard Library][
97The standard library does not put some or all of the contents of
98`<exception>` in namespace std.
99]]
100[[`BOOST_NO_EXCEPTIONS`][Compiler][
101The compiler does not support exception handling (this setting is typically
102required by many C++ compilers for embedded platforms). Note that there is
103no requirement for boost libraries to honor this configuration setting -
104indeed doing so may be impossible in some cases. Those libraries that do
105honor this will typically abort if a critical error occurs - you have been
106warned!
107]]
108[[`BOOST_NO_FUNCTION_TEMPLATE_ORDERING`][Compiler][
109The compiler does not perform function template ordering or its function
110template ordering is incorrect.
111``
112// #1
113template<class T> void f(T);
114
115// #2
116template<class T,class U> void f(T(*)(U));
117
118void bar(int);
119
120f(&bar); // should choose #2.
121``
122]]
123[[`BOOST_NO_INCLASS_MEMBER_INITIALIZATION`][Compiler][
124Compiler violates std::9.4.2/4.
125]]
126[[`BOOST_NO_INTRINSIC_WCHAR_T`][Compiler][
127The C++ implementation does not provide `wchar_t`, or it is really a synonym
128for another integral type. Use this symbol to decide whether it is appropriate
129to explicitly specialize a template on `wchar_t` if there is already a
130specialization for other integer types.
131]]
132[[`BOOST_NO_IOSFWD`][std lib][
133The standard library lacks `<iosfwd>`.
134]]
135[[`BOOST_NO_IOSTREAM`][std lib][
136The standard library lacks `<iostream>`, `<istream>` or `<ostream>`.
137]]
138[[`BOOST_NO_IS_ABSTRACT`][Compiler][
139The C++ compiler does not support SFINAE with abstract types, this is covered
140by __CORE_LANGUAGE_DR337__, but is not part of the current standard. Fortunately
141most compilers that support SFINAE also support this DR.
142]]
143[[`BOOST_NO_LIMITS`][Standard library][
144The C++ implementation does not provide the `<limits>` header. Never check for
145this symbol in library code; always include `<boost/limits.hpp>`, which
146guarantees to provide `std::numeric_limits`.
147]]
148[[`BOOST_NO_CXX11_NUMERIC_LIMITS`][Standard library][
149C++11 additions to `std::numeric_limits` are not available for use.
150`static function numeric_limits<T>::lowest()` the lowest finite value representable by the numeric type.
151`static int const max_digits10` the number of decimal digits that are required to make sure that two distinct values of the type have distinct decimal representations.
152`template<> class numeric_limits<char16_t>;`, see also `BOOST_NO_CXX11_CHAR16_T`,
153`template<> class numeric_limits<char32_t>;` see also `BOOST_NO_CXX11_CHAR32_T`.
154Replaces BOOST_NO_NUMERIC_LIMITS_LOWEST.
155]]
156[[`BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS`][Standard library][
157Constants such as `numeric_limits<T>::is_signed` are not available for use
158at compile-time.
159]]
160[[`BOOST_NO_LONG_LONG_NUMERIC_LIMITS`][Standard library][
161There is no specialization for `numeric_limits<long long>` and
162`numeric_limits<unsigned long long>`. `<boost/limits.hpp>` will then add these
163specializations as a standard library "fix" only if the compiler supports the
164`long long` datatype.
165]]
166[[`BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS`][Compiler][
167The compiler does not support the specialization of individual member
168functions of template classes.
169]]
170[[`BOOST_NO_MEMBER_TEMPLATE_KEYWORD`][Compiler][
171If the compiler supports member templates, but not the template keyword
172when accessing member template classes.
173]]
174[[`BOOST_NO_MEMBER_TEMPLATE_FRIENDS`][Compiler][
175Member template friend syntax (`template<class P> friend class frd;`)
176described in the C++ Standard, 14.5.3, not supported.
177]]
178[[`BOOST_NO_MEMBER_TEMPLATES`][Compiler][
179Member template functions not fully supported.
180]]
181[[`BOOST_NO_MS_INT64_NUMERIC_LIMITS`][Standard library][
182There is no specialization for `numeric_limits<__int64>` and
183`numeric_limits<unsigned __int64>`. `<boost/limits.hpp>` will then add these
184specializations as a standard library "fix", only if the compiler supports
185the `__int64` datatype.
186]]
187[[`BOOST_NO_NESTED_FRIENDSHIP`][Compiler][
188Compiler doesn't allow a nested class to access private members of its
189containing class. Probably Borland/CodeGear specific.
190]]
191[[`BOOST_NO_OPERATORS_IN_NAMESPACE`][Compiler][
192Compiler requires inherited operator friend functions to be defined at
193namespace scope, then using'ed to boost. Probably GCC specific. See
194[@../../../../boost/operators.hpp `<boost/operators.hpp>`] for example.
195]]
196[[`BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS`][Compiler][
197The compiler does not correctly handle partial specializations
198which depend upon default arguments in the primary template.
199]]
200[[`BOOST_NO_POINTER_TO_MEMBER_CONST`][Compiler][
201The compiler does not correctly handle pointers to const member functions,
202preventing use of these in overloaded function templates. See
203[@../../../../boost/functional.hpp `<boost/functional.hpp>`] for example.
204]]
205[[`BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS`][Compiler][
206Pointers to members don't work when used as template parameters.
207]]
208[[`BOOST_NO_PRIVATE_IN_AGGREGATE`][Compiler][
209The compiler misreads 8.5.1, treating classes as non-aggregate if they
210contain private or protected member functions.
211]]
212[[`BOOST_NO_RTTI`][Compiler][
213The compiler may (or may not) have the typeid operator, but RTTI on the dynamic type
214of an object is not supported.
215]]
216[[`BOOST_NO_SFINAE`][Compiler][
217The compiler does not support the "Substitution Failure Is Not An Error"
218meta-programming idiom.
219]]
220[[`BOOST_NO_SFINAE_EXPR`][Compiler][
221The compiler does not support usage of SFINAE with arbitrary expressions.
222]]
223[[`BOOST_NO_STD_ALLOCATOR`][Standard library][
224The C++ standard library does not provide a standards conforming
225`std::allocator`.
226]]
227[[`BOOST_NO_STD_DISTANCE`][Standard library][
228The platform does not have a conforming version of `std::distance`.
229]]
230[[`BOOST_NO_STD_ITERATOR`][Standard library][
231The C++ implementation fails to provide the `std::iterator` class.
232]]
233[[`BOOST_NO_STD_ITERATOR_TRAITS`][Standard library][
234The compiler does not provide a standard compliant implementation of
235`std::iterator_traits`. Note that the compiler may still have a
236non-standard implementation.
237]]
238[[`BOOST_NO_STD_LOCALE`][Standard library][
239The standard library lacks `std::locale`.
240]]
241[[`BOOST_NO_STD_MESSAGES`][Standard library][
242The standard library lacks a conforming `std::messages` facet.
243]]
244[[`BOOST_NO_STD_MIN_MAX`][Standard library][
245The C++ standard library does not provide the `min()` and `max()` template
246functions that should be in `<algorithm>`.
247]]
248[[`BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN`][Standard library][
249Defined if the standard library's output iterators are not assignable.
250]]
251[[`BOOST_NO_STD_TYPEINFO`][Standard library][
252The <typeinfo> header declares `type_info` in the global namespace instead of namespace std.
253]]
254[[`BOOST_NO_STD_USE_FACET`][Standard library][
255The standard library lacks a conforming `std::use_facet`.
256]]
257[[`BOOST_NO_STD_WSTREAMBUF`][Standard library][
258The standard library's implementation of `std::basic_streambuf<wchar_t>`
259is either missing, incomplete, or buggy.
260]]
261[[`BOOST_NO_STD_WSTRING`][Standard library][
262The standard library lacks `std::wstring`.
263]]
264[[`BOOST_NO_STDC_NAMESPACE`][Compiler, Platform][
265The contents of C++ standard headers for C library functions
266(the `<c...>` headers) have not been placed in namespace std. This test is
267difficult - some libraries "fake" the std C functions by adding using
268declarations to import them into namespace std, unfortunately they don't
269necessarily catch all of them...
270]]
271[[`BOOST_NO_STRINGSTREAM`][Standard library][
272The C++ implementation does not provide the `<sstream>` header.
273]]
274[[`BOOST_NO_SWPRINTF`][Platform][
275The platform does not have a conforming version of `swprintf`.
276]]
277[[`BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION`][Compiler][
278Class template partial specialization (14.5.4 \[temp.class.spec\]) not
279supported.
280]]
281[[`BOOST_NO_TEMPLATED_IOSTREAMS`][Standard library][
282The standard library does not provide templated iostream classes.
283]]
284[[`BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS`][Standard library][
285The standard library does not provide templated iterator constructors
286for its containers.
287]]
288[[`BOOST_NO_TEMPLATE_TEMPLATES`][Compiler][
289The compiler does not support template template parameters.
290]]
291[[`BOOST_NO_TYPEID`][Compiler][
292The compiler does not support the typeid operator at all.
293]]
294[[`BOOST_NO_TYPENAME_WITH_CTOR`][Compiler][
295The typename keyword cannot be used when creating a temporary of a
296Dependent type.
297]]
298[[`BOOST_NO_UNREACHABLE_RETURN_DETECTION`][Compiler][
299If a return is unreachable, then no return statement should be required,
300however some compilers insist on it, while other issue a bunch of warnings
301if it is in fact present.
302]]
303[[`BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE`][Compiler][
304The compiler will not accept a using declaration that brings a function
305from a typename used as a base class into a derived class if functions of
306the same name are present in the derived class.
307]]
308[[`BOOST_NO_USING_TEMPLATE`][Compiler][
309The compiler will not accept a using declaration that imports a template
310class or function from another namespace. Originally a Borland specific
311problem with imports to/from the global namespace, extended to MSVC6
312which has a specific issue with importing template classes (but not
313functions).
314]]
315[[`BOOST_NO_VOID_RETURNS`][Compiler][
316The compiler does not allow a void function to return the result of calling
317another void function.
318``
319void f() {}
320void g() { return f(); }
321``
322]]
323]
324
325[endsect]
326
327[#config_features]
328
329
330[section Macros that describe optional features]
331
332The following macros describe features that are not required by the C++
333standard. The macro is only defined if the feature is present.
334
335
336[table
337[[Macro ][Section ][Description ]]
338
339[[`BOOST_HAS_BETHREADS`][Platform][
340The platform supports BeOS style threads.
341]]
342[[`BOOST_HAS_CLOCK_GETTIME`][Platform][
343The platform has the POSIX API `clock_gettime`.
344]]
345[[`BOOST_HAS_DIRENT_H`][Platform][
346The platform has the POSIX header `<dirent.h>`.
347]]
348[[`BOOST_HAS_EXPM1`][Platform][
349The platform has the functions `expm1`, `expm1f` and `expm1l` in `<math.h>`
350]]
351[[`BOOST_HAS_FLOAT128`][Compiler][
352The compiler has `__float128` as a native type which is distinct
353from all the regular C++ floating point types.]]
354[[`BOOST_HAS_FTIME`][Platform][
355The platform has the Win32 API type FTIME.
356]]
357[[`BOOST_HAS_GETSYSTEMTIMEASFILETIME`][Platform][
358The platform has the Win32 API GetSystemTimeAsFileTime.
359]]
360[[`BOOST_HAS_GETTIMEOFDAY`][Platform][
361The platform has the POSIX API `gettimeofday`.
362]]
363[[`BOOST_HAS_HASH`][Standard library][
364The C++ implementation provides the (SGI) hash_set and hash_map classes.
365When defined, `BOOST_HASH_SET_HEADER` and `BOOST_HASH_LIST_HEADER` will contain
366the names of the header needed to access hash_set and hash_map;
367`BOOST_STD_EXTENSION_NAMESPACE` will provide the namespace in which the two
368class templates reside.
369]]
370[[`BOOST_HAS_INT128`][Compiler][
371The compiler has `__int128` and `unsigned __int128` as native types which are distinct
372from all the regular C++ integer types.]]
373[[`BOOST_HAS_LOG1P`][Platform][
374The platform has the functions `log1p`, `log1pf` and `log1pl` in `<math.h>`.
375]]
376[[`BOOST_HAS_MACRO_USE_FACET`][Standard library][
377The standard library lacks a conforming `std::use_facet`, but has a macro
378`_USE(loc, Type)` that does the job. This is primarily for the Dinkumware
379std lib.
380]]
381[[`BOOST_HAS_MS_INT64`][Compiler][
382The compiler supports the `__int64` data type.
383]]
384[[`BOOST_HAS_NANOSLEEP`][Platform][
385The platform has the POSIX API nanosleep.
386]]
387[[`BOOST_HAS_NL_TYPES_H`][Platform][
388The platform has an `<nl_types.h>`.
389]]
390[[`BOOST_HAS_NRVO`][Compiler][
391Indicated that the compiler supports the named return value optimization
392(NRVO). Used to select the most efficient implementation for some function.
393See [@../../../../boost/operators.hpp `<boost/operators.hpp>`] for example.
394]]
395[[`BOOST_HAS_PARTIAL_STD_ALLOCATOR`][Standard Library][
396The standard library has a partially conforming `std::allocator` class, but
397without any of the member templates.
398]]
399[[`BOOST_HAS_PRAGMA_ONCE`][Compiler][
400The compiler recognizes the `#pragma once` directive which tells that the
401containing header should be included only once while preprocessing the
402current translation unit. The pragma may improve compile times of large projects
403with some compilers.
404]]
405[[`BOOST_HAS_PRAGMA_DETECT_MISMATCH`][Compiler][
406The compiler recognizes the `#pragma detect_mismatch("name", "value")` directive which tells that the
407link stage should be terminated with error if values for provided `"name"` missmatch.
408This pragma may be a help in preventing ODR violations and ensuring that different modules
409are compiled with same flags.
410]]
411
412[[`BOOST_HAS_PTHREAD_DELAY_NP`][Platform][
413The platform has the POSIX API `pthread_delay_np`.
414]]
415[[`BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE`][Platform][
416The platform has the POSIX API `pthread_mutexattr_settype`.
417]]
418[[`BOOST_HAS_PTHREAD_YIELD`][Platform][
419The platform has the POSIX API `pthread_yield`.
420]]
421[[`BOOST_HAS_PTHREADS`][Platform][
422The platform support POSIX style threads.
423]]
424[[`BOOST_HAS_SCHED_YIELD`][Platform][
425The platform has the POSIX API `sched_yield`.
426]]
427[[`BOOST_HAS_SGI_TYPE_TRAITS`][Compiler, Standard library][
428The compiler has native support for SGI style type traits.
429]]
430[[`BOOST_HAS_STDINT_H`][Platform][
431The platform has a `<stdint.h>`
432]]
433[[`BOOST_HAS_SLIST`][Standard library][
434The C++ implementation provides the (SGI) slist class. When defined,
435`BOOST_SLIST_HEADER` will contain the name of the header needed to access
436`slist` and `BOOST_STD_EXTENSION_NAMESPACE` will provide the namespace in
437which `slist` resides.
438]]
439[[`BOOST_HAS_STLP_USE_FACET`][Standard library][
440The standard library lacks a conforming `std::use_facet`, but has a workaround
441class-version that does the job. This is primarily for the STLport std lib.
442]]
443[[`BOOST_HAS_TR1_ARRAY`][Standard library][
444The library has a TR1 conforming version of `<array>`. This macro is only guaranteed
445to be defined after including one of the headers from Boost.TR1. Further this macro
446is now deprecated in favour of BOOST_NO_CXX11_HDR_ARRAY.
447]]
448[[`BOOST_HAS_TR1_COMPLEX_OVERLOADS`][Standard library][
449The library has a version of `<complex>` that supports passing scalars to the
450complex number algorithms.
451]]
452[[`BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG`][Standard library][
453The library has a version of `<complex>` that includes the new inverse trig
454functions from TR1.
455]]
456[[`BOOST_HAS_TR1_REFERENCE_WRAPPER`][Standard library][
457The library has TR1 conforming reference wrappers in `<functional>`. This macro is only guaranteed
458to be defined after including one of the headers from Boost.TR1. Further this macro
459is now deprecated in favour of BOOST_NO_CXX11_HDR_FUNCTIONAL.
460]]
461[[`BOOST_HAS_TR1_RESULT_OF`][Standard library][
462The library has a TR1 conforming result_of template in `<functional>`. This macro is only guaranteed
463to be defined after including one of the headers from Boost.TR1. Further this macro
464is now deprecated in favour of BOOST_NO_CXX11_HDR_FUNCTIONAL.
465]]
466[[`BOOST_HAS_TR1_MEM_FN`][Standard library][
467The library has a TR1 conforming mem_fn function template in `<functional>`. This macro is only guaranteed
468to be defined after including one of the headers from Boost.TR1. Further this macro
469is now deprecated in favour of BOOST_NO_CXX11_HDR_FUNCTIONAL.
470]]
471[[`BOOST_HAS_TR1_BIND`][Standard library][
472The library has a TR1 conforming bind function template in `<functional>`. This macro is only guaranteed
473to be defined after including one of the headers from Boost.TR1. Further this macro
474is now deprecated in favour of BOOST_NO_CXX11_HDR_FUNCTIONAL.
475]]
476[[`BOOST_HAS_TR1_FUNCTION`][Standard library][
477The library has a TR1 conforming function class template in `<functional>`. This macro is only guaranteed
478to be defined after including one of the headers from Boost.TR1. Further this macro
479is now deprecated in favour of BOOST_NO_CXX11_HDR_FUNCTIONAL.
480]]
481[[`BOOST_HAS_TR1_HASH`][Standard library][
482The library has a TR1 conforming hash function template in `<functional>`. This macro is only guaranteed
483to be defined after including one of the headers from Boost.TR1. Further this macro
484is now deprecated in favour of BOOST_NO_CXX11_HDR_FUNCTIONAL.
485]]
486[[`BOOST_HAS_TR1_SHARED_PTR`][Standard library][
487The library has a TR1 conforming `shared_ptr` class template in `<memory>`. This macro is only guaranteed
488to be defined after including one of the headers from Boost.TR1. Further this macro
489is now deprecated in favour of BOOST_NO_CXX11_SMART_PTR.
490]]
491[[`BOOST_HAS_TR1_RANDOM`][Standard library][
492The library has a TR1 conforming version of `<random>`. This macro is only guaranteed
493to be defined after including one of the headers from Boost.TR1. Further this macro
494is now deprecated in favour of BOOST_NO_CXX11_HDR_RANDOM.
495]]
496[[`BOOST_HAS_TR1_REGEX`][Standard library][
497The library has a TR1 conforming version of `<regex>`. This macro is only guaranteed
498to be defined after including one of the headers from Boost.TR1. Further this macro
499is now deprecated in favour of BOOST_NO_CXX11_HDR_REGEX.
500]]
501[[`BOOST_HAS_TR1_TUPLE`][Standard library][
502The library has a TR1 conforming version of `<tuple>`. This macro is only guaranteed
503to be defined after including one of the headers from Boost.TR1. Further this macro
504is now deprecated in favour of BOOST_NO_CXX11_HDR_TUPLE.
505]]
506[[`BOOST_HAS_TR1_TYPE_TRAITS`][Standard library][
507The library has a TR1 conforming version of `<type_traits>`. This macro is only guaranteed
508to be defined after including one of the headers from Boost.TR1. Further this macro
509is now deprecated in favour of BOOST_NO_CXX11_HDR_TYPE_TRAITS.
510]]
511[[`BOOST_HAS_TR1_UTILITY`][Standard library][
512The library has the TR1 additions to `<utility>` (tuple interface to `std::pair`). This macro is only guaranteed
513to be defined after including one of the headers from Boost.TR1. Further this macro
514is now deprecated in favour of BOOST_NO_CXX11_HDR_TUPLE.
515]]
516[[`BOOST_HAS_TR1_UNORDERED_MAP`][Standard library][
517The library has a TR1 conforming version of `<unordered_map>`. This macro is only guaranteed
518to be defined after including one of the headers from Boost.TR1. Further this macro
519is now deprecated in favour of BOOST_NO_CXX11_HDR_UNORDERED_MAP.
520]]
521[[`BOOST_HAS_TR1_UNORDERED_SET`][Standard library][
522The library has a TR1 conforming version of `<unordered_set>`. This macro is only guaranteed
523to be defined after including one of the headers from Boost.TR1. Further this macro
524is now deprecated in favour of BOOST_NO_CXX11_HDR_UNORDERED_SET.
525]]
526[[`BOOST_HAS_TR1`][Standard library][
527Implies all the other `BOOST_HAS_TR1_*` macros should be set.
528]]
529[[`BOOST_HAS_THREADS`][Platform, Compiler][
530Defined if the compiler, in its current translation mode, supports multiple
531threads of execution.
532]]
533[[`BOOST_HAS_TWO_ARG_USE_FACET`][Standard library][
534The standard library lacks a conforming std::use_facet, but has a two
535argument version that does the job. This is primarily for the Rogue Wave
536std lib.
537]]
538[[`BOOST_HAS_UNISTD_H`][Platform][
539The Platform provides `<unistd.h>`.
540]]
541[[`BOOST_HAS_WINTHREADS`][Platform][
542The platform supports MS Windows style threads.
543]]
544[[`BOOST_MSVC_STD_ITERATOR`][Standard library][
545Microsoft's broken version of `std::iterator` is being used. This implies that
546`std::iterator` takes no more than two template parameters.
547]]
548[[`BOOST_MSVC6_MEMBER_TEMPLATES`][Compiler][
549Microsoft Visual C++ 6.0 has enough member template idiosyncrasies
550(being polite) that `BOOST_NO_MEMBER_TEMPLATES` is defined for this compiler.
551`BOOST_MSVC6_MEMBER_TEMPLATES` is defined to allow compiler specific workarounds.
552This macro gets defined automatically if `BOOST_NO_MEMBER_TEMPLATES` is not
553defined - in other words this is treated as a strict subset of the features
554required by the standard.
555]]
556[[`BOOST_HAS_STDINT_H`][Platform][
557There are no 1998 C++ Standard headers `<stdint.h>` or `<cstdint>`, although the
5581999 C Standard does include `<stdint.h>`. If `<stdint.h>` is present,
559`<boost/stdint.h>` can make good use of it, so a flag is supplied (signalling
560presence; thus the default is not present, conforming to the current C++
561standard).
562]]
563]
564
565[endsect]
566
567[section Macros that describe possible C++ future features]
568
569The following macros describe features that may be included in some future
570ISO C++ standard, but have not yet been approved for inclusion in the language.
571
572
573[table
574[[Macro ][Description ]]
575
576[[`BOOST_HAS_CONCEPTS`][
577The compiler supports concepts.
578]]
579]
580
581[endsect]
582
583[section Macros that describe C++11 features not supported]
584
585The following macros describe features in the 2011 ISO C++ standard, formerly known as C++0x,
586that are not yet supported by a particular compiler or library.
587
588[table
589[[Macro ][Description ]]
590
591[[`BOOST_NO_CXX11_ADDRESSOF`][The standard library header <memory> has no working std::addressof.]]
592[[`BOOST_NO_CXX11_ALIGNAS`][The compiler does not support the `alignas` keyword.]]
593[[`BOOST_NO_CXX11_ALLOCATOR`][The standard library does not provide a C++11 version of `std::allocator` in <memory>.]]
594[[`BOOST_NO_CXX11_ATOMIC_SMART_PTR`][The standard library <memory> does not support atomic smart pointer operations.]]
595[[`BOOST_NO_CXX11_AUTO_DECLARATIONS`][The compiler does not support
596type deduction for variables declared with the `auto` keyword (`auto var = ...;`).
597]]
598[[`BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS`][The compiler does not support
599type deduction for multiple variables declared with the `auto` keyword (`auto var = ..., *ptr = ...;`).
600]]
601[[`BOOST_NO_CXX11_CHAR16_T`][The compiler does not support
602type `char16_t`.
603]]
604[[`BOOST_NO_CXX11_CHAR32_T`][The compiler does not support
605type `char32_t`.
606]]
607[[`BOOST_NO_CXX11_CONSTEXPR`][The compiler does not support
608`constexpr`.
609]]
610[[`BOOST_NO_CXX11_DECLTYPE`][The compiler does not support
611`decltype`.
612]]
613[[`BOOST_NO_CXX11_DECLTYPE_N3276`][The compiler does not support the extension to
614`decltype` described in [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3276.pdf N3276],
615accepted in Madrid, March 2011.
616]]
617[[`BOOST_NO_CXX11_DELETED_FUNCTIONS`][The compiler does not support
618deleted (`= delete`) functions.
619]]
620[[`BOOST_NO_CXX11_DEFAULTED_FUNCTIONS`][The compiler does not support
621defaulted (`= default`) functions.
622]]
623[[`BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS`][The compiler does not support
624explicit conversion operators (`explicit operator T()`).
625]]
626[[`BOOST_NO_CXX11_EXTERN_TEMPLATE`][The compiler does not support
627explicit instantiation forward declarations for templates (`extern template ...`).
628]]
629[[`BOOST_NO_CXX11_FINAL`][The compiler does not support the C++ class-virt-specifier final.
630]]
631[[`BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS`][The compiler does not support
632expanding a variadic template parameter pack into a template containing one or more
633fixed arguments]]
634[[`BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS`][The compiler does not support
635default template arguments for function templates.
636]]
637[[`BOOST_NO_CXX11_HDR_ATOMIC`][The standard library does not provide header <atomic>.]]
638[[`BOOST_NO_CXX11_HDR_ARRAY`][The standard library does not provide header <array>.]]
639[[`BOOST_NO_CXX11_HDR_CHRONO`][The standard library does not provide header <chrono>.]]
640[[`BOOST_NO_CXX11_HDR_CODECVT`][The standard library does not provide header <codecvt>.]]
641[[`BOOST_NO_CXX11_HDR_CONDITION_VARIABLE`][The standard library does not provide header <condition_variable>.]]
642[[`BOOST_NO_CXX11_HDR_FORWARD_LIST`][The standard library does not provide header <forward_list>.]]
643[[`BOOST_NO_CXX11_HDR_FUNCTIONAL`][The standard library does not provide a C++11 compatible version of <functional>.]]
644[[`BOOST_NO_CXX11_HDR_FUTURE`][The standard library does not provide header <future>.]]
645[[`BOOST_NO_CXX11_HDR_INITIALIZER_LIST`][The standard library does not provide header <initializer_list>.]]
646[[`BOOST_NO_CXX11_HDR_MUTEX`][The standard library does not provide header <mutex>.]]
647[[`BOOST_NO_CXX11_HDR_RANDOM`][The standard library does not provide header <random>.]]
648[[`BOOST_NO_CXX11_HDR_RATIO`][The standard library does not provide header <ratio>.]]
649[[`BOOST_NO_CXX11_HDR_REGEX`][The standard library does not provide header <regex>.]]
650[[`BOOST_NO_CXX11_HDR_SYSTEM_ERROR`][The standard library does not provide header <system_error>.]]
651[[`BOOST_NO_CXX11_HDR_THREAD`][The standard library does not provide header <thread>.]]
652[[`BOOST_NO_CXX11_HDR_TUPLE`][The standard library does not provide header <tuple>.]]
653[[`BOOST_NO_CXX11_HDR_TYPEINDEX`][The standard library does not provide header <typeindex>.]]
654[[`BOOST_NO_CXX11_HDR_TYPE_TRAITS`][The standard library does not provide header <type_traits>.]]
655[[`BOOST_NO_CXX11_HDR_UNORDERED_MAP`][The standard library does not provide header <unordered_map>.]]
656[[`BOOST_NO_CXX11_HDR_UNORDERED_SET`][The standard library does not provide header <unordered_set>.]]
657
658[[`BOOST_NO_CXX11_INLINE_NAMESPACES`][The compiler does not support inline namespaces.]]
659[[`BOOST_NO_CXX11_LAMBDAS`][The compiler does not support Lambdas.
660]]
661[[`BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS`][The compiler does not allow to
662pass local classes as template parameters (this macro intentionally does not
663control passing of unnamed types as template parameters, see also
664[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm N2657]).
665]]
666[[`BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS`][The compiler does not support
667defaulted (`= default`) functions in access control sections other than `public`. Public defaulted
668functions may still be supported, as indicated by `BOOST_NO_CXX11_DEFAULTED_FUNCTIONS`. Some
669compilers implementing an early draft of the C++11 standard (in particular, incorporating
670[@http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#906 DR906]) are susceptible to this problem.
671]]
672[[`BOOST_NO_CXX11_NOEXCEPT`][The compiler does not support `noexcept`.
673]]
674[[`BOOST_NO_CXX11_NULLPTR`][The compiler does not support `nullptr`.
675]]
676[[`BOOST_NO_CXX11_NUMERIC_LIMITS`][The standard library `<limits>` header does
677not support the C++11 version of `numeric_limits`.
678]]
679[[`BOOST_NO_CXX11_RANGE_BASED_FOR`][The compiler does not support
680range-based for statements.
681]]
682[[`BOOST_NO_CXX11_RAW_LITERALS`][The compiler does not support
683raw string literals.
684]]
685[[`BOOST_NO_CXX11_REF_QUALIFIERS`][The compiler does not support
686ref-qualifiers on member functions as described in
687[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2439.htm N2439].
688]]
689[[`BOOST_NO_CXX11_RVALUE_REFERENCES`][The compiler does not support
690r-value references.
691]]
692[[`BOOST_NO_CXX11_SCOPED_ENUMS`][The compiler does not support
693scoped enumerations (`enum class`).
694]]
695[[`BOOST_NO_CXX11_SMART_PTR`][The standard library header <memory> has no shared_ptr and unique_ptr.]]
696[[`BOOST_NO_CXX11_STATIC_ASSERT`][The compiler does not support
697`static_assert`.
698]]
699[[`BOOST_NO_CXX11_STD_ALIGN`][The standard library header <memory> has no working std::align.]]
700[[`BOOST_NO_CXX11_STD_UNORDERED`][The standard library does not support
701<unordered_map> and <unordered_set>.
702]]
703[[`BOOST_NO_CXX11_TEMPLATE_ALIASES`][The compiler does not support template aliases.
704]]
705[[`BOOST_NO_CXX11_THREAD_LOCAL`][The compiler does not support the `thread_local` storage specifier.
706]]
707[[`BOOST_NO_CXX11_TRAILING_RESULT_TYPES`][The compiler does not support the new function result type
708specification syntax (e.g. `auto foo(T) -> T;`).]]
709[[`BOOST_NO_CXX11_UNICODE_LITERALS`][The compiler does not support
710Unicode (`u8`, `u`, `U`) literals.
711]]
712[[`BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX`][The compiler does not support
713the [@http://en.wikipedia.org/wiki/C%2B%2B0x#Uniform_initialization C++11 Unified Initialization Syntax].
714]]
715[[`BOOST_NO_CXX11_USER_DEFINED_LITERALS`][The compiler does not support user defined literals.
716]]
717[[`BOOST_NO_CXX11_VARIADIC_TEMPLATES`][The compiler does not support
718variadic templates.
719]]
720[[`BOOST_NO_CXX11_VARIADIC_MACROS`][The compiler does not support
721variadic macros.
722]]
723[[`BOOST_NO_LONG_LONG`][The compiler does not support `long long`.
724]]
725]
726
727[endsect]
728
729[#config_11_for_03]
730
731[section Macros that allow use of C++11 features with C++03 compilers]
732
733The following macros allow use of C++11 features even with compilers that do not yet
734provide compliant C++11 support.
735
736[table
737[[Macro ][ Description ]]
738
739[[`BOOST_ALIGNMENT(X)`, `BOOST_NO_ALIGNMENT`][
740Some compilers don't support the `alignas` keyword but provide other means to specify alignment
741(usually, through compiler-specific attributes). The macro `BOOST_ALIGNMENT(X)` will expand to the `alignas(X)`
742keyword if the compiler supports it or to some compiler-specific attribute to achieve the specified alignment.
743If no such compiler-specific attribute is known then `BOOST_ALIGNMENT(X)` will expand to nothing and
744`BOOST_NO_ALIGNMENT` will be defined. Unlike native `alignas`, `X` must always be a compile-time integer constant.
745The macro can be used to specify alignment of types and data:
746``
747 struct BOOST_ALIGNMENT(16) my_data
748 {
749 char c[16];
750 };
751 BOOST_ALIGNMENT(8) int arr[32];
752``
753]]
754[[`BOOST_CONSTEXPR`][
755Some compilers don't support the use of `constexpr`. This macro expands to nothing on those compilers, and `constexpr`
756elsewhere. For example, when defining a constexpr function or constructor replace:
757``
758 constexpr tuple();
759``
760with:
761``
762 BOOST_CONSTEXPR tuple();
763``
764]]
765[[`BOOST_CONSTEXPR_OR_CONST`][
766Some compilers don't support the use of `constexpr`. This macro expands to `const` on those compilers, and `constexpr`
767elsewhere. For example, when defining const expr variables replace:
768``
769 static constexpr UIntType xor_mask = a;
770``
771with:
772``
773 static BOOST_CONSTEXPR_OR_CONST UIntType xor_mask = a;
774``
775]]
776[[`BOOST_STATIC_CONSTEXPR`][
777This is a shortcut for `static BOOST_CONSTEXPR_OR_CONST`. For example, when defining const expr variables replace:
778``
779 static constexpr UIntType xor_mask = a;
780``
781with:
782``
783 BOOST_STATIC_CONSTEXPR UIntType xor_mask = a;
784``
785]]
786[[`BOOST_DEFAULTED_FUNCTION(fun, body)`][
787This macro is intended to be used within a class definition in order to declare a default implementation of function `fun`.
788For the compilers that do not support C++11 defaulted functions the macro will expand into an inline function definition
789with the `body` implementation. For example:
790``
791 struct my_struct
792 {
793 BOOST_DEFAULTED_FUNCTION(my_struct(), {})
794 };
795``
796is equivalent to:
797``
798 struct my_struct
799 {
800 my_struct() = default;
801 };
802``
803or:
804``
805 struct my_struct
806 {
807 my_struct() {}
808 };
809``
810]]
811[[`BOOST_DELETED_FUNCTION(fun)`][
812This macro is intended to be used within a class definition in order to declare a deleted function `fun`.
813For the compilers that do not support C++11 deleted functions the macro will expand into a private function
814declaration with no definition. Since the macro may change the access mode, it is recommended to use this macro
815at the end of the class definition. For example:
816``
817 struct noncopyable
818 {
819 BOOST_DELETED_FUNCTION(noncopyable(noncopyable const&))
820 BOOST_DELETED_FUNCTION(noncopyable& operator= (noncopyable const&))
821 };
822``
823is equivalent to:
824``
825 struct noncopyable
826 {
827 noncopyable(noncopyable const&) = delete;
828 noncopyable& operator= (noncopyable const&) = delete;
829 };
830``
831or:
832``
833 struct noncopyable
834 {
835 private:
836 noncopyable(noncopyable const&);
837 noncopyable& operator= (noncopyable const&);
838 };
839``
840]]
841[[
842``
843 BOOST_NOEXCEPT
844 BOOST_NOEXCEPT_OR_NOTHROW
845 BOOST_NOEXCEPT_IF(Predicate)
846 BOOST_NOEXCEPT_EXPR(Expression)
847``
848][
849If `BOOST_NO_CXX11_NOEXCEPT` is defined (i.e. C++03 compliant compilers) these macros are defined as:
850[:
851``
852 #define BOOST_NOEXCEPT
853 #define BOOST_NOEXCEPT_OR_NOTHROW throw()
854 #define BOOST_NOEXCEPT_IF(Predicate)
855 #define BOOST_NOEXCEPT_EXPR(Expression) false
856``
857]
858If `BOOST_NO_CXX11_NOEXCEPT` is not defined (i.e. C++11 compliant compilers) they are defined as:
859[:
860``
861 #define BOOST_NOEXCEPT noexcept
862 #define BOOST_NOEXCEPT_OR_NOTHROW noexcept
863 #define BOOST_NOEXCEPT_IF(Predicate) noexcept((Predicate))
864 #define BOOST_NOEXCEPT_EXPR(Expression) noexcept((Expression))
865``
866]
867]]
868[[`BOOST_MSVC_ENABLE_2012_NOV_CTP`][
869For Microsoft Visual C++ 2012, enable the C++11 features supplied by the
870November 2012 Community Technology Preview. These features are not automatically
871enabled because the CTP is non-supported alpha code that is not recommended
872for production use. This macro must be defined before including any Boost headers,
873and must be defined for all translation units in the program, including Boost library builds.
874This macro will no longer have any effect once an official Microsoft
875release supports the CTP features.
876]]
877]
878
879[endsect]
880
881[section Macros that describe C++14 features not supported]
882
883The following macros describe features in the 2014 ISO C++ standard, formerly known as C++0y,
884that are not yet supported by a particular compiler or library.
885
886[table
887[[Macro ][Description ]]
888[[`BOOST_NO_CXX14_AGGREGATE_NSDMI`][The compiler does not support member initializer for aggregates as in the following example:
889[:
890``
891struct Foo
892{
893 int x, y = 42;
894};
895
896Foo foo = { 0 };
897``
898]
899]]
900[[`BOOST_NO_CXX14_BINARY_LITERALS`][The compiler does not binary literals (e.g. `0b1010`).]]
901[[`BOOST_NO_CXX14_CONSTEXPR`][The compiler does not support relaxed `constexpr`.]]
902[[`BOOST_NO_CXX14_DECLTYPE_AUTO`][The compiler does not support `decltype(auto)`.]]
903[[`BOOST_NO_CXX14_DIGIT_SEPARATORS`][The compiler does not support digit separators (e.g. `1'000'000`).]]
904[[`BOOST_NO_CXX14_GENERIC_LAMBDAS`][The compiler does not support generic lambda (e.g. `[](auto v){ }`).]]
905[[`BOOST_NO_CXX14_HDR_SHARED_MUTEX`][The standard library does not provide header <shared_mutex>.]]
906[[`BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES`][The compiler does not support initialized lambda capture (e.g. `[foo = 42]{ }`).]]
907[[`BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION`][The compiler does not support return type deduction for normal functions (e.g. `auto f() { return val; }`).]]
908[[`BOOST_NO_CXX14_VARIABLE_TEMPLATES`][The compiler does not support variable template (e.g. `template <class T> T kibi = T(1024);`).]]
909]
910
911[endsect]
912
913[#config_14_for_11]
914
915[section Macros that allow use of C++14 features with C++11 or earlier compilers]
916
917The following macros allow use of C++14 features even with compilers that do not yet
918provide compliant C++14 support.
919
920[table
921[[Macro ][ Description ]]
922[[`BOOST_CXX14_CONSTEXPR`][This macro works similar to BOOST_CONSTEXPR, but expands to `constexpr` only if the C++14 "relaxed" `constexpr` is available.]]
923]
924
925[endsect]
926
927[section Macros that describe C++17 features not supported]
928
929The following macros describe features in the 2016 ISO C++ standard, formerly known as C++1z,
930that are not yet supported by a particular compiler or library.
931
932[table
933[[Macro ][Description ]]
934[[`BOOST_NO_CXX17_STD_INVOKE`][The compiler does not support `std::invoke()`.]]
935]
936
937[endsect]
938
939[#config_helpers]
940
941[section Boost Helper Macros]
942
943The following macros are either simple helpers, or macros that provide
944workarounds for compiler/standard library defects.
945
946
947[table
948[[Macro ][Description ]]
949
950[[`BOOST_WORKAROUND`][
951This macro is used where a compiler specific workaround is required that is not otherwise
952described by one of the other Boost.Config macros. To use the macro you must first
953``
954#include <boost/detail/workaround.hpp>
955``
956usage is then:
957``
958#if BOOST_WORKAROUND(MACRONAME, CONDITION)
959 // workaround code goes here...
960#else
961 // Standard conforming code goes here...
962#endif
963``
964where `MACRONAME` is a macro that usually describes the version number to be tested against, and `CONDITION`
965is a comparison operator followed by a value. For example `BOOST_WORKAROUND(BOOST_INTEL, <= 1010)` would
966evaluate to `1` for Intel C++ 10.1 and earlier.
967
968The macro can also be used with `BOOST_TESTED_AT` if all
969current compiler versions exhibit the issue, but the issue is expected to be fixed at some later point.
970
971For example
972`BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x590))` would normally evaluate to `1` for all values
973of `__BORLANDC__` /unless/ the macro `BOOST_DETECT_OUTDATED_WORKAROUNDS` is defined, in which case evaluates to
974`(__BORLANDC__ <= 0x590)`.
975
976[*Note]: the ultimate source of documentation for this macro is in [@../../../../boost/detail/workaround.hpp boost/detail/workaround.hpp].
977]]
978[[`BOOST_PREVENT_MACRO_SUBSTITUTION`][
979Sometimes you have a function name with the same name as a C macro, for example "min" and "max"
980member functions, in which case one can prevent the function being expanded as a macro using:
981``
982someclass.min BOOST_PREVENT_MACRO_SUBSTITUTION(arg1, arg2);
983``
984The following also works in most, but not all, contexts:
985``
986(someclass.max)(arg1, arg2);
987``
988]]
989[[`BOOST_DEDUCED_TYPENAME`][
990Some compilers don't support the use of typename for dependent types in deduced
991contexts. This macro expands to nothing on those compilers, and typename
992elsewhere. For example, replace:
993`template <class T> void f(T, typename T::type);`
994with:
995`template <class T> void f(T, BOOST_DEDUCED_TYPENAME T::type);`
996]]
997[[`BOOST_HASH_MAP_HEADER`][
998The header to include to get the SGI `hash_map` class. This macro is only
999available if `BOOST_HAS_HASH` is defined.
1000]]
1001[[`BOOST_HASH_SET_HEADER`][
1002The header to include to get the SGI `hash_set` class. This macro is only
1003available if `BOOST_HAS_HASH` is defined.
1004]]
1005[[`BOOST_SLIST_HEADER`][
1006The header to include to get the SGI `slist` class. This macro is only
1007available if `BOOST_HAS_SLIST` is defined.
1008]]
1009[[`BOOST_STD_EXTENSION_NAMESPACE`][
1010The namespace used for std library extensions (hashtable classes etc).
1011]]
1012[[`BOOST_STATIC_CONSTANT(Type, assignment)`][
1013On compilers which don't allow in-class initialization of static integral
1014constant members, we must use enums as a workaround if we want the constants
1015to be available at compile-time. This macro gives us a convenient way to
1016declare such constants.
1017For example instead of:
1018``
1019struct foo{
1020 static const int value = 2;
1021};
1022``
1023use:
1024``
1025struct foo{
1026 BOOST_STATIC_CONSTANT(int, value = 2);
1027};
1028``
1029]]
1030[[`BOOST_UNREACHABLE_RETURN(result)`][
1031Normally evaluates to nothing, but evaluates to return x; if the compiler
1032requires a return, even when it can never be reached.
1033]]
1034[[`BOOST_FALLTHROUGH`][
1035The BOOST_FALLTHROUGH macro can be used to annotate implicit fall-through
1036between switch labels:
1037``
1038 switch (x) {
1039 case 40:
1040 case 41:
1041 if (truth_is_out_there) {
1042 ++x;
1043 BOOST_FALLTHROUGH; // Use instead of/along with annotations in
1044 // comments.
1045 } else {
1046 return x;
1047 }
1048 case 42:
1049 ...
1050``
1051As shown in the example above, the BOOST_FALLTHROUGH macro should be
1052followed by a semicolon. It is designed to mimic control-flow statements
1053like 'break;', so it can be placed in most places where 'break;' can, but
1054only if there are no statements on the execution path between it and the
1055next switch label.
1056
1057When compiled with Clang >3.2 in C++11 mode, the BOOST_FALLTHROUGH macro is
1058expanded to `[[clang::fallthrough]]` attribute, which is analysed when
1059performing switch labels fall-through diagnostic ('-Wimplicit-fallthrough').
1060See clang [@http://clang.llvm.org/docs/LanguageExtensions.html#clang__fallthrough
1061documentation on language extensions for details.]
1062
1063When used with unsupported compilers, the BOOST_FALLTHROUGH macro has no
1064effect on diagnostics.
1065
1066In either case this macro has no effect on runtime behavior and performance
1067of code.
1068]]
1069[[`BOOST_EXPLICIT_TEMPLATE_TYPE(t)`
1070 `BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t,v)`
1071 `BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t)`
1072 `BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t,v)`][
1073Some compilers silently "fold" different function template instantiations if
1074some of the template parameters don't appear in the function parameter list.
1075For instance:
1076``
1077 #include <iostream>
1078 #include <ostream>
1079 #include <typeinfo>
1080
1081 template <int n>
1082 void f() { std::cout << n << ' '; }
1083
1084 template <typename T>
1085 void g() { std::cout << typeid(T).name() << ' '; }
1086
1087 int main() {
1088 f<1>();
1089 f<2>();
1090
1091 g<int>();
1092 g<double>();
1093 }
1094``
1095incorrectly outputs [^2 2 double double] on VC++ 6. These macros, to be used
1096in the function parameter list, fix the problem without effects on the calling
1097syntax. For instance, in the case above write:
1098``
1099 template <int n>
1100 void f(BOOST_EXPLICIT_TEMPLATE_NON_TYPE(int, n)) { ... }
1101
1102 template <typename T>
1103 void g(BOOST_EXPLICIT_TEMPLATE_TYPE(T)) { ... }
1104``
1105Beware that they can declare (for affected compilers) a dummy defaulted
1106parameter, so they
1107
1108[*a)] should be always invoked [*at the end] of the parameter list
1109
1110[*b)] can't be used if your function template is multiply declared.
1111
1112Furthermore, in order to add any needed comma separator, an `APPEND_*` version
1113must be used when the macro invocation appears after a normal parameter
1114declaration or after the invocation of another macro of this same group.
1115]]
1116[[`BOOST_USE_FACET(Type, loc)`][
1117When the standard library does not have a conforming `std::use_facet` there
1118are various workarounds available, but they differ from library to library.
1119This macro provides a consistent way to access a locale's facets. For example,
1120replace:
1121`std::use_facet<Type>(loc);`
1122with:
1123`BOOST_USE_FACET(Type, loc);`
1124Note do not add a `std::` prefix to the front of `BOOST_USE_FACET`.
1125]]
1126[[`BOOST_HAS_FACET(Type, loc)`][
1127When the standard library does not have a comforming `std::has_facet` there
1128are various workarounds available, but they differ from library to library.
1129This macro provides a consistent way to check a locale's facets. For example,
1130replace:
1131`std::has_facet<Type>(loc);`
1132with:
1133`BOOST_HAS_FACET(Type, loc);`
1134Note do not add a `std::` prefix to the front of `BOOST_HAS_FACET`.
1135]]
1136[[`BOOST_NESTED_TEMPLATE`][
1137Member templates are supported by some compilers even though they can't use
1138the `A::template member<U>` syntax, as a workaround replace:
1139`typedef typename A::template rebind<U> binder;`
1140with:
1141`typedef typename A::BOOST_NESTED_TEMPLATE rebind<U> binder;`
1142]]
1143[[`BOOST_STRINGIZE(X)`][
1144Converts the parameter `X` to a string after macro replacement on `X` has
1145been performed.
1146]]
1147[[`BOOST_JOIN(X,Y)`][
1148This piece of macro magic joins the two arguments together, even when one of
1149the arguments is itself a macro (see 16.3.1 in C++ standard). This is normally
1150used to create a mangled name in combination with a predefined macro such a
1151\_\_LINE__.
1152]]
1153[[`BOOST_FORCEINLINE`][
1154This macro can be used in place of the `inline` keyword to instruct the compiler
1155that the function should always be inlined.
1156Overuse of this macro can lead to significant bloat, while good use can increase
1157performance in certain cases, such as computation-intensive code built through
1158generative programming techniques.
1159
1160Usage example:
1161``
1162 template<class T>
1163 BOOST_FORCEINLINE T& f(T& t)
1164 {
1165 return t;
1166 }
1167``
1168
1169Note that use of this macro can lead to cryptic error messages with some compilers.
1170Consider defining it to `inline` before including the Boost.Config header in order to be
1171able to debug errors more easily.
1172]]
1173[[`BOOST_NOINLINE`][
1174This macro can be used in place of the `inline` keyword to instruct the compiler
1175that the function should never be inlined. One should typically use this macro
1176to mark functions that are unlikely to be called, such as error handling routines.
1177
1178Usage example:
1179``
1180 BOOST_NOINLINE void handle_error(const char* descr)
1181 {
1182 // ...
1183 }
1184``
1185]]
1186[[`BOOST_NORETURN`][
1187This macro can be used before the function declaration or definition to instruct the compiler
1188that the function does not return normally (i.e. with a `return` statement or by leaving
1189the function scope, if the function return type is `void`). The macro can be used to mark
1190functions that always throw exceptions or terminate the application. Compilers that support
1191this markup may use this information to specifically organize the code surrounding calls to
1192this function and suppress warnings about missing `return` statements in the functions
1193enclosing such calls.
1194
1195Usage example:
1196``
1197 BOOST_NORETURN void on_error_occurred(const char* descr)
1198 {
1199 throw std::runtime_error(descr);
1200 }
1201``
1202
1203If the compiler does not support this markup, `BOOST_NORETURN` is defined empty and an
1204additional macro `BOOST_NO_NORETURN` is defined.
1205]]
1206[[`BOOST_LIKELY(X)`
1207 `BOOST_UNLIKELY(X)`][
1208These macros communicate to the compiler that the conditional expression `X` is likely
1209or unlikely to yield a positive result. The expression should result in a boolean value.
1210The result of the macro is an integer or boolean value equivalent to the result of `X`.
1211
1212The macros are intended to be used in branching statements. The additional hint they provide
1213can be used by the compiler to arrange the compiled code of the branches more effectively.
1214
1215Usage example:
1216``
1217 if (BOOST_UNLIKELY(ptr == NULL))
1218 handle_error("ptr is NULL");
1219``
1220]]
1221[[`BOOST_ATTRIBUTE_UNUSED`][Expands to `__attribute__((unused))` when this is available -
1222can be used to disable compiler warnings relating to unused types or variables.]]
1223]
1224
1225[endsect]
1226
1227[#config_info_macros]
1228
1229[section Boost Informational Macros]
1230
1231The following macros describe boost features; these are, generally speaking
1232the only boost macros that should be tested in user code.
1233
1234[table
1235
1236[[Macro ][Header ][Description ]]
1237
1238[[`BOOST_VERSION`][`<boost/version.hpp>`][
1239Describes the boost version number in XYYYZZ format such that:
1240`(BOOST_VERSION % 100)` is the sub-minor version, `((BOOST_VERSION / 100) % 1000)`
1241is the minor version, and `(BOOST_VERSION / 100000)` is the major version.
1242]]
1243[[`BOOST_NO_INT64_T`][`<boost/cstdint.hpp>` `<boost/stdint.h>`][
1244Defined if there are no 64-bit integral types: `int64_t`, `uint64_t` etc.
1245]]
1246[[`BOOST_NO_INTEGRAL_INT64_T`][`<boost/cstdint.hpp>` `<boost/stdint.h>`][
1247Defined if `int64_t` as defined by `<boost/cstdint.hpp>` is not usable in
1248integral constant expressions.
1249]]
1250[[`BOOST_MSVC`][`<boost/config.hpp>`][
1251Defined if the compiler is really Microsoft Visual C++, as opposed to one
1252of the many other compilers that also define `_MSC_VER`. Has the same value as
1253_MSC_VER.
1254]]
1255[[`BOOST_MSVC_FULL_VER`][`<boost/config.hpp>`][
1256Defined to a normalised 9 digit version of _MSC_FULL_VER (which sometimes only has 8 digits),
1257the macro has the form VVMMPPPPP where VV is the major version number, MM is the minor version number, and
1258PPPPP is the compiler build number.
1259]]
1260[[`BOOST_GCC`][`<boost/config.hpp>`][
1261Defined if the compiler is really GCC, as opposed to one
1262of the many other compilers that also define `__GNUC__`. Has the value:
1263`__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__`.
1264]]
1265[[`BOOST_INTEL`][`<boost/config.hpp>`][
1266Defined if the compiler is an Intel compiler, takes the same value as the
1267compiler version macro.
1268]]
1269[[`BOOST_CLANG`][`<boost/config.hpp>`][
1270Defined to 1 if the compiler is the Clang compiler.
1271]]
1272[[`BOOST_WINDOWS`][`<boost/config.hpp>`][
1273Defined if the Windows platform API is available.
1274]]
1275[[`BOOST_DINKUMWARE_STDLIB`][`<boost/config.hpp>`][
1276Defined if the dinkumware standard library is in use, takes the same value
1277as the Dinkumware library version macro `_CPPLIB_VER` if defined, otherwise 1.
1278]]
1279[[`BOOST_NO_WREGEX`][`<boost/regex.hpp>`][
1280Defined if the regex library does not support wide character regular
1281expressions.
1282]]
1283[[`BOOST_COMPILER`][`<boost/config.hpp>`][
1284Defined as a string describing the name and version number of the compiler
1285in use. Mainly for debugging the configuration.
1286]]
1287[[`BOOST_STDLIB`][`<boost/config.hpp>`][
1288Defined as a string describing the name and version number of the standard
1289library in use. Mainly for debugging the configuration.
1290]]
1291[[`BOOST_PLATFORM`][`<boost/config.hpp>`][
1292Defined as a string describing the name of the platform. Mainly for debugging
1293the configuration.
1294]]
1295]
1296
1297[endsect]
1298
1299[#deprecated_macros]
1300
1301[section Boost Deprecated Macros]
1302
1303The following have been deprecated; please use the replacements instead.
1304They will be removed in a future version of boost.
1305
1306[table
1307
1308[[Deprecated Macro][Replacement][When deprecated][When removed]]
1309
1310[[`BOOST_NO_0X_HDR_ARRAY`][`BOOST_NO_CXX11_HDR_ARRAY`][Boost 1.50][]]
1311[[`BOOST_NO_0X_HDR_CHRONO`][`BOOST_NO_CXX11_HDR_CHRONO`][Boost 1.50][]]
1312[[`BOOST_NO_0X_HDR_CODECVT`][`BOOST_NO_CXX11_HDR_CODECVT`][Boost 1.50][]]
1313[[`BOOST_NO_0X_HDR_CONDITION_VARIABLE`][`BOOST_NO_CXX11_HDR_CONDITION_VARIABLE`][Boost 1.50][]]
1314[[`BOOST_NO_0X_HDR_FORWARD_LIST`][`BOOST_NO_CXX11_HDR_FORWARD_LIST`][Boost 1.50][]]
1315[[`BOOST_NO_0X_HDR_FUTURE`][`BOOST_NO_CXX11_HDR_FUTURE`][Boost 1.50][]]
1316[[`BOOST_NO_0X_HDR_INITIALIZER_LIST`][`BOOST_NO_CXX11_HDR_INITIALIZER_LIST`][Boost 1.50][]]
1317[[`BOOST_NO_INITIALIZER_LISTS`][`BOOST_NO_CXX11_HDR_INITIALIZER_LIST`][Boost 1.50][]]
1318[[`BOOST_NO_0X_HDR_MUTEX`][`BOOST_NO_CXX11_HDR_MUTEX`][Boost 1.50][]]
1319[[`BOOST_NO_0X_HDR_RANDOM`][`BOOST_NO_CXX11_HDR_RANDOM`][Boost 1.50][]]
1320[[`BOOST_NO_0X_HDR_RATIO`][`BOOST_NO_CXX11_HDR_RATIO`][Boost 1.50][]]
1321[[`BOOST_NO_0X_HDR_REGEX`][`BOOST_NO_CXX11_HDR_REGEX`][Boost 1.50][]]
1322[[`BOOST_NO_0X_HDR_SYSTEM_ERROR`][`BOOST_NO_CXX11_HDR_SYSTEM_ERROR`][Boost 1.50][]]
1323[[`BOOST_NO_0X_HDR_THREAD`][`BOOST_NO_CXX11_HDR_THREAD`][Boost 1.50][]]
1324[[`BOOST_NO_0X_HDR_TUPLE`][`BOOST_NO_CXX11_HDR_TUPLE`][Boost 1.50][]]
1325[[`BOOST_NO_0X_HDR_TYPE_TRAITS`][`BOOST_NO_CXX11_HDR_TYPE_TRAITS`][Boost 1.50][]]
1326[[`BOOST_NO_0X_HDR_TYPEINDEX`][`BOOST_NO_CXX11_HDR_TYPEINDEX`][Boost 1.50][]]
1327[[`BOOST_NO_0X_HDR_UNORDERED_SET`][`BOOST_NO_CXX11_HDR_UNORDERED_SET`][Boost 1.50][]]
1328[[`BOOST_NO_0X_HDR_UNORDERED_MAP`][`BOOST_NO_CXX11_HDR_UNORDERED_MAP`][Boost 1.50][]]
1329[[`BOOST_NO_STD_UNORDERED`][`BOOST_NO_CXX11_HDR_UNORDERED_SET`][Boost 1.50][]]
1330[[][][][]]
1331[[`BOOST_NO_AUTO_DECLARATIONS`][`BOOST_NO_CXX11_AUTO_DECLARATIONS`][Boost 1.51][]]
1332[[`BOOST_NO_AUTO_MULTIDECLARATIONS`][`BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS`][Boost 1.51][]]
1333[[`BOOST_NO_CHAR16_T`][`BOOST_NO_CXX11_CHAR16_T`][Boost 1.51][]]
1334[[`BOOST_NO_CHAR32_T`][`BOOST_NO_CXX11_CHAR32_T`][Boost 1.51][]]
1335[[`BOOST_NO_TEMPLATE_ALIASES`][`BOOST_NO_CXX11_TEMPLATE_ALIASES`][Boost 1.51][]]
1336[[`BOOST_NO_CONSTEXPR`][`BOOST_NO_CXX11_CONSTEXPR`][Boost 1.51][]]
1337[[`BOOST_NO_DECLTYPE`][`BOOST_NO_CXX11_DECLTYPE`][Boost 1.51][]]
1338[[`BOOST_NO_DECLTYPE_N3276`][`BOOST_NO_CXX11_DECLTYPE_N3276`][Boost 1.51][]]
1339[[`BOOST_NO_DEFAULTED_FUNCTIONS`][`BOOST_NO_CXX11_DEFAULTED_FUNCTIONS`][Boost 1.51][]]
1340[[`BOOST_NO_DELETED_FUNCTIONS`][`BOOST_NO_CXX11_DELETED_FUNCTIONS`][Boost 1.51][]]
1341[[`BOOST_NO_EXPLICIT_CONVERSION_OPERATORS`][`BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS`][Boost 1.51][]]
1342[[`BOOST_NO_EXTERN_TEMPLATE`][`BOOST_NO_CXX11_EXTERN_TEMPLATE`][Boost 1.51][]]
1343[[`BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS`][`BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS`][Boost 1.51][]]
1344[[`BOOST_NO_LAMBDAS`][`BOOST_NO_CXX11_LAMBDAS`][Boost 1.51][]]
1345[[`BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS`][`BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS`][Boost 1.51][]]
1346[[`BOOST_NO_NOEXCEPT`][`BOOST_NO_CXX11_NOEXCEPT`][Boost 1.51][]]
1347[[`BOOST_NO_NULLPTR`][`BOOST_NO_CXX11_NULLPTR`][Boost 1.51][]]
1348[[`BOOST_NO_RAW_LITERALS`][`BOOST_NO_CXX11_RAW_LITERALS`][Boost 1.51][]]
1349[[`BOOST_NO_RVALUE_REFERENCES`][`BOOST_NO_CXX11_RVALUE_REFERENCES`][Boost 1.51][]]
1350[[`BOOST_NO_SCOPED_ENUMS`][`BOOST_NO_CXX11_SCOPED_ENUMS`][Boost 1.51][]]
1351[[`BOOST_NO_STATIC_ASSERT`][`BOOST_NO_CXX11_STATIC_ASSERT`][Boost 1.51][]]
1352[[`BOOST_NO_STD_UNORDERED`][`BOOST_NO_CXX11_STD_UNORDERED`][Boost 1.51][]]
1353[[`BOOST_NO_UNICODE_LITERALS`][`BOOST_NO_CXX11_UNICODE_LITERALS`][Boost 1.51][]]
1354[[`BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX`][`BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX`][Boost 1.51][]]
1355[[`BOOST_NO_VARIADIC_TEMPLATES`][`BOOST_NO_CXX11_VARIADIC_TEMPLATES`][Boost 1.51][]]
1356[[`BOOST_NO_VARIADIC_MACROS`][`BOOST_NO_CXX11_VARIADIC_MACROS`][Boost 1.51][]]
1357[[`BOOST_NO_NUMERIC_LIMITS_LOWEST`][`BOOST_NO_CXX11_NUMERIC_LIMITS`][Boost 1.51][]]
1358[[][][][]]
1359[[`BOOST_HAS_STATIC_ASSERT`][`BOOST_NO_CXX11_STATIC_ASSERT` (negated)][Boost 1.53][]]
1360[[`BOOST_HAS_VARIADIC_TMPL`][`BOOST_NO_CXX11_VARIADIC_TEMPLATES` (negated)][Boost 1.53][]]
1361[[`BOOST_HAS_RVALUE_REFS`][`BOOST_NO_CXX11_RVALUE_REFERENCES` (negated)][Boost 1.53][]]
1362[[`BOOST_HAS_CHAR16_T`][`BOOST_NO_CXX11_CHAR16_T` (negated)][Boost 1.53][]]
1363[[`BOOST_HAS_CHAR32_T`][`BOOST_NO_CXX11_CHAR32_T` (negated)][Boost 1.53][]]
1364]
1365
1366[endsect]
1367
1368[section Macros for libraries with separate source code]
1369
1370The following macros and helper headers are of use to authors whose libraries
1371include separate source code, and are intended to address several issues:
1372
1373* Controlling shared library symbol visibility
1374* Fixing the ABI of the compiled library
1375* Selecting which compiled library to link against based upon the compilers settings
1376
1377See [@http://www.boost.org/development/separate_compilation.html Guidelines for Authors of Boost Libraries Containing Separate Source]
1378
1379[section Macros controlling shared library symbol visibility]
1380
1381Some compilers support C++ extensions that control which symbols
1382will be exported from shared libraries such as dynamic shared objects (DSO's) on Unix-like
1383systems or dynamic-link libraries (DLL's) on Windows.
1384
1385The Microsoft VC++ compiler has long supplied
1386`__declspec(dllexport)` and `__declspec(dllimport)` extensions for this purpose,
1387as do virtually all other compilers targeting the Windows platform.
1388
1389Modern versions of the GNU GCC compiler provide the `__attribute__((visibility("default")))`
1390extension to indicate that a symbol should be exported. All other symbols may be hidden by using the
1391`-fvisibility-hidden` or `-fvisibility-ms-compat` compiler switches.
1392
1393Boost supplies several macros to make it easier to manage symbol visibility in a way that
1394is portable between compilers and operating systems.
1395
1396[table
1397[[Macro ][Description ]]
1398[[`BOOST_SYMBOL_EXPORT`][
1399Defines the syntax of a C++ language extension that indicates a symbol is to be exported from a shared library.
1400If the compiler has no such extension, the macro is defined with no replacement text.
1401]]
1402[[`BOOST_SYMBOL_IMPORT`][
1403Defines the syntax of a C++ language extension that indicates a symbol is to be imported from a shared library.
1404If the compiler has no such extension, the macro is defined with no replacement text.
1405]]
1406[[`BOOST_SYMBOL_VISIBLE`][
1407Defines the syntax of a C++ language extension that indicates a symbol is to be globally visible.
1408If the compiler has no such extension, the macro is defined with no replacement text.
1409Needed for classes that are not otherwise exported, but are used by RTTI. Examples include
1410class for objects that will be thrown as exceptions or used in dynamic_casts,
1411across shared library boundaries. For example, a header-only exception class might look like this:
1412``
1413 class BOOST_SYMBOL_VISIBLE my_exception : public std::runtime_error { ... };
1414``
1415Without BOOST_SYMBOL_VISIBLE, it would be impossible to catch my_exception thrown from a shared library
1416compiled by GCC with the -fvisibility=hidden option.
1417]]
1418[[`BOOST_HAS_DECLSPEC`][
1419The compiler has C++ extensions `__declspec(dllexport)` and `__declspec(dllimport)` to control
1420export/import of symbols from shared libraries.
1421['Deprecated. This macro is no longer necessary since BOOST_SYMBOL_EXPORT and BOOST_SYMBOL_IMPORT
1422are now supplied. It is provided to support legacy code.]
1423]]
1424]
1425
1426Typical usage:
1427
1428[*boost/foo/config.hpp]
1429
1430 ...
1431 #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FOO_DYN_LINK)
1432 # if defined(BOOST_FOO_SOURCE)
1433 # define BOOST_FOO_DECL BOOST_SYMBOL_EXPORT
1434 # else
1435 # define BOOST_FOO_DECL BOOST_SYMBOL_IMPORT
1436 # endif
1437 #else
1438 # define BOOST_FOO_DECL
1439 #endif
1440 ...
1441
1442[*boost/foo/foo.hpp]
1443
1444 #include <boost/foo/config.hpp>
1445 ...
1446 class BOOST_FOO_DECL bar { ... };
1447 ...
1448 void BOOST_FOO_DECL f();
1449 ...
1450
1451[*boost/libs/foo/src/foo.cpp]
1452
1453 #define BOOST_FOO_SOURCE
1454 #include <boost/foo/foo.hpp>
1455 ...
1456 void BOOST_FOO_DECL f()
1457 {
1458 ...
1459 }
1460 ...
1461
1462[endsect]
1463
1464[section ABI Fixing]
1465
1466When linking against a pre-compiled library it vital that the ABI used by the
1467compiler when building the library ['matches exactly] the ABI used by the code
1468using the library. In this case ABI means things like the struct packing
1469arrangement used, the name mangling scheme used, or the size of some types
1470(enum types for example). This is separate from things like threading support,
1471or runtime library variations, which have to be dealt with by build variants.
1472To put this in perspective there is one compiler (Borland's) that has so many
1473compiler options that make subtle changes to the ABI, that at least in theory
1474there 3200 combinations, and that's without considering runtime library
1475variations. Fortunately these variations can be managed by `#pragma`'s that
1476tell the compiler what ABI to use for the types declared in your library.
1477In order to avoid sprinkling `#pragma`'s all over the boost headers, there are
1478some prefix and suffix headers that do the job. Typical usage is:
1479
1480[*my_library.hpp]
1481
1482 #ifndef MY_INCLUDE_GUARD
1483 #define MY_INCLUDE_GUARD
1484
1485 // all includes go here:
1486 ``[^[*#include <boost/config.hpp>]]``
1487 #include <whatever>
1488
1489 ``[^[*#include <boost/config/abi_prefix.hpp>]]`` // must be the last #include
1490
1491 namespace boost {
1492
1493 // your code goes here
1494
1495 }
1496
1497 ``[^[*#include <boost/config/abi_suffix.hpp>]]`` // pops abi_prefix.hpp pragmas
1498
1499 #endif // include guard
1500
1501[*my_library.cpp]
1502
1503 ...
1504 // nothing special need be done in the implementation file
1505 ...
1506
1507The user can disable this mechanism by defining `BOOST_DISABLE_ABI_HEADERS`, or
1508they can define `BOOST_ABI_PREFIX` and/or `BOOST_ABI_SUFFIX` to point to their
1509own prefix/suffix headers if they so wish.
1510
1511[endsect]
1512
1513[section Automatic library selection]
1514
1515It is essential that users link to a build of a library which was built against
1516the same runtime library that their application will be built against -if this
1517does not happen then the library will not be binary compatible with their own
1518code- and there is a high likelihood that their application will experience
1519runtime crashes. These kinds of problems can be extremely time consuming and
1520difficult to debug, and often lead to frustrated users and authors alike (simply
1521selecting the right library to link against is not as easy as it seems when
1522their are 6-8 of them to chose from, and some users seem to be blissfully
1523unaware that there even are different runtimes available to them).
1524
1525To solve this issue, some compilers allow source code to contain `#pragma`'s that
1526instruct the linker which library to link against, all the user need do is
1527include the headers they need, place the compiled libraries in their library
1528search path, and the compiler and linker do the rest. Boost.config supports
1529this via the header `<boost/config/auto_link.hpp>`, before including this header
1530one or more of the following macros need to be defined:
1531
1532[variablelist
1533[[`BOOST_LIB_NAME`][
1534Required: An identifier containing the basename of the library, for
1535example 'boost_regex'.
1536]]
1537[[`BOOST_DYN_LINK`][
1538Optional: when set link to dll rather than static library.
1539]]
1540[[`BOOST_LIB_DIAGNOSTIC`][
1541Optional: when set the header will print out the name of the library selected
1542(useful for debugging).
1543]]
1544]
1545
1546If the compiler supports this mechanism, then it will be told to link against
1547the appropriately named library, the actual algorithm used to mangle the name
1548of the library is documented inside `<boost/config/auto_link.hpp>` and has to
1549match that used to create the libraries via bjam 's install rules.
1550
1551
1552[*my_library.hpp]
1553
1554 ...
1555 //
1556 // Don't include auto-linking code if the user has disabled it by
1557 // defining BOOST_ALL_NO_LIB, or BOOST_MY_LIBRARY_NO_LIB, or if this
1558 // is one of our own source files (signified by BOOST_MY_LIBRARY_SOURCE):
1559 //
1560 #if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_MY_LIBRARY_NO_LIB) && !defined(BOOST_MY_LIBRARY_SOURCE)
1561 # define BOOST_LIB_NAME boost_my_library
1562 # ifdef BOOST_MY_LIBRARY_DYN_LINK
1563 # define BOOST_DYN_LINK
1564 # endif
1565 # include <boost/config/auto_link.hpp>
1566 #endif
1567 ...
1568
1569[*my_library.cpp]
1570
1571 // define BOOST_MY_LIBRARY_SOURCE so that the header knows that the
1572 // library is being built (possibly exporting rather than importing code)
1573 //
1574 #define BOOST_MY_LIBRARY_SOURCE
1575
1576 #include <boost/my_library/my_library.hpp>
1577 ...
1578
1579[endsect]
1580
1581[endsect]
1582
1583[endsect]
1584
1585
1586