workaround.hpp 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
  4. // Software License, Version 1.0. (See accompanying file
  5. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // See http://www.boost.org/libs/container for documentation.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. #ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
  11. #define BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
  12. #ifndef BOOST_CONFIG_HPP
  13. # include <boost/config.hpp>
  14. #endif
  15. #if defined(BOOST_HAS_PRAGMA_ONCE)
  16. # pragma once
  17. #endif
  18. #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)\
  19. && !defined(BOOST_INTERPROCESS_DISABLE_VARIADIC_TMPL)
  20. #define BOOST_CONTAINER_PERFECT_FORWARDING
  21. #endif
  22. #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && defined(__GXX_EXPERIMENTAL_CXX0X__)\
  23. && (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40700)
  24. #define BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST
  25. #endif
  26. #if defined(BOOST_GCC_VERSION)
  27. # if (BOOST_GCC_VERSION < 40700) || !defined(BOOST_GCC_CXX11)
  28. # define BOOST_CONTAINER_NO_CXX11_DELEGATING_CONSTRUCTORS
  29. # endif
  30. #elif defined(BOOST_MSVC)
  31. # if _MSC_FULL_VER < 180020827
  32. # define BOOST_CONTAINER_NO_CXX11_DELEGATING_CONSTRUCTORS
  33. # endif
  34. #elif defined(BOOST_CLANG)
  35. # if !__has_feature(cxx_delegating_constructors)
  36. # define BOOST_CONTAINER_NO_CXX11_DELEGATING_CONSTRUCTORS
  37. # endif
  38. #endif
  39. #if defined(BOOST_MSVC) && (_MSC_VER < 1400)
  40. #define BOOST_CONTAINER_TEMPLATED_CONVERSION_OPERATOR_BROKEN
  41. #endif
  42. #if !defined(BOOST_NO_CXX11_HDR_TUPLE) || (defined(BOOST_MSVC) && (BOOST_MSVC == 1700 || BOOST_MSVC == 1600))
  43. #define BOOST_CONTAINER_PAIR_TEST_HAS_HEADER_TUPLE
  44. #endif
  45. //Macros for documentation purposes. For code, expands to the argument
  46. #define BOOST_CONTAINER_IMPDEF(TYPE) TYPE
  47. #define BOOST_CONTAINER_SEEDOC(TYPE) TYPE
  48. //Macros for memset optimization. In most platforms
  49. //memsetting pointers and floatings is safe and faster.
  50. //
  51. //If your platform does not offer these guarantees
  52. //define these to value zero.
  53. #ifndef BOOST_CONTAINER_MEMZEROED_FLOATING_POINT_IS_NOT_ZERO
  54. #define BOOST_CONTAINER_MEMZEROED_FLOATING_POINT_IS_ZERO 1
  55. #endif
  56. #ifndef BOOST_CONTAINER_MEMZEROED_POINTER_IS_NOT_NULL
  57. #define BOOST_CONTAINER_MEMZEROED_POINTER_IS_NULL
  58. #endif
  59. #define BOOST_CONTAINER_DOC1ST(TYPE1, TYPE2) TYPE2
  60. #define BOOST_CONTAINER_I ,
  61. #define BOOST_CONTAINER_DOCIGN(T) T
  62. #define BOOST_CONTAINER_DOCONLY(T)
  63. /*
  64. we need to import/export our code only if the user has specifically
  65. asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost
  66. libraries to be dynamically linked, or BOOST_CONTAINER_DYN_LINK
  67. if they want just this one to be dynamically liked:
  68. */
  69. #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CONTAINER_DYN_LINK)
  70. /* export if this is our own source, otherwise import: */
  71. #ifdef BOOST_CONTAINER_SOURCE
  72. # define BOOST_CONTAINER_DECL BOOST_SYMBOL_EXPORT
  73. #else
  74. # define BOOST_CONTAINER_DECL BOOST_SYMBOL_IMPORT
  75. #endif /* BOOST_CONTAINER_SOURCE */
  76. #else
  77. #define BOOST_CONTAINER_DECL
  78. #endif /* DYN_LINK */
  79. //#define BOOST_CONTAINER_DISABLE_FORCEINLINE
  80. #if defined(BOOST_CONTAINER_DISABLE_FORCEINLINE)
  81. #define BOOST_CONTAINER_FORCEINLINE inline
  82. #elif defined(BOOST_CONTAINER_FORCEINLINE_IS_BOOST_FORCELINE)
  83. #define BOOST_CONTAINER_FORCEINLINE BOOST_FORCEINLINE
  84. #elif defined(BOOST_MSVC) && defined(_DEBUG)
  85. //"__forceinline" and MSVC seems to have some bugs in debug mode
  86. #define BOOST_CONTAINER_FORCEINLINE inline
  87. #elif defined(__GNUC__) && ((__GNUC__ < 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ < 5)))
  88. //Older GCCs have problems with forceinline
  89. #define BOOST_CONTAINER_FORCEINLINE inline
  90. #else
  91. #define BOOST_CONTAINER_FORCEINLINE BOOST_FORCEINLINE
  92. #endif
  93. //#define BOOST_CONTAINER_DISABLE_NOINLINE
  94. #if defined(BOOST_CONTAINER_DISABLE_NOINLINE)
  95. #define BOOST_CONTAINER_NOINLINE
  96. #else
  97. #define BOOST_CONTAINER_NOINLINE BOOST_NOINLINE
  98. #endif
  99. #if !defined(__has_feature)
  100. #define BOOST_CONTAINER_HAS_FEATURE(feature) 0
  101. #else
  102. #define BOOST_CONTAINER_HAS_FEATURE(feature) __has_feature(feature)
  103. #endif
  104. //Detect address sanitizer
  105. #if defined(__SANITIZE_ADDRESS__) || BOOST_CONTAINER_HAS_FEATURE(address_sanitizer)
  106. #define BOOST_CONTAINER_ASAN
  107. #endif
  108. #if (__cplusplus >= 201703L)
  109. //CTAD supported
  110. #ifdef __INTEL_COMPILER
  111. //Intel compilers do not offer this feature yet
  112. #define BOOST_CONTAINER_NO_CXX17_CTAD
  113. #endif
  114. #else
  115. #define BOOST_CONTAINER_NO_CXX17_CTAD
  116. #endif
  117. #if defined(BOOST_CONTAINER_DISABLE_ATTRIBUTE_NODISCARD)
  118. #define BOOST_CONTAINER_ATTRIBUTE_NODISCARD
  119. #else
  120. #if defined(BOOST_GCC) && ((BOOST_GCC < 100000) || (__cplusplus < 201703L))
  121. //Avoid using it in C++ < 17 and GCC < 10 because it warns in SFINAE contexts
  122. //(see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89070)
  123. #define BOOST_CONTAINER_ATTRIBUTE_NODISCARD
  124. #else
  125. #define BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_ATTRIBUTE_NODISCARD
  126. #endif
  127. #endif
  128. //Configuration options:
  129. //Define this to use std exception types instead of boost::container's own exception types
  130. //#define BOOST_CONTAINER_USE_STD_EXCEPTIONS
  131. #endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP