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