macro_reference.qbk 68 KB

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