workaround.hpp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. #if !defined(__has_feature)
  94. #define BOOST_CONTAINER_HAS_FEATURE(feature) 0
  95. #else
  96. #define BOOST_CONTAINER_HAS_FEATURE(feature) __has_feature(feature)
  97. #endif
  98. //Detect address sanitizer
  99. #if defined(__SANITIZE_ADDRESS__) || BOOST_CONTAINER_HAS_FEATURE(address_sanitizer)
  100. #define BOOST_CONTAINER_ASAN
  101. #endif
  102. #if (__cplusplus >= 201703L)
  103. //CTAD supported
  104. #ifdef __INTEL_COMPILER
  105. //Intel compilers do not offer this feature yet
  106. #define BOOST_CONTAINER_NO_CXX17_CTAD
  107. #endif
  108. #else
  109. #define BOOST_CONTAINER_NO_CXX17_CTAD
  110. #endif
  111. #endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP