config.hpp 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // Copyright Daniel Wallin, David Abrahams 2005.
  2. // Copyright Cromwell D. Enage 2017.
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. #ifndef BOOST_PARAMETER_CONFIG_050403_HPP
  7. #define BOOST_PARAMETER_CONFIG_050403_HPP
  8. #include <boost/config.hpp>
  9. #include <boost/config/workaround.hpp>
  10. // Allow projects to #define BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING to
  11. // turn off perfect forwarding as necessary. Otherwise, also require correct
  12. // SFINAE support, needed explicitly by tagged_argument & keyword & cast;
  13. // correct function template ordering, needed by the code generation macros;
  14. // rvalue references, needed throughout; variadic templates, needed by
  15. // parameters; function template default arguments, needed by the code
  16. // generation macros; and the ability to handle multiple parameter packs,
  17. // needed by parameters. Older versions of GCC either don't have the latter
  18. // ability or cannot disambiguate between keyword's overloaded
  19. // operators. Older versions of Clang either fail to compile due to
  20. // differences in length between parameter packs 'Args' and 'args' or fail at
  21. // runtime due to segmentation faults.
  22. // -- Cromwell D. Enage
  23. #if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
  24. !defined(BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING) && \
  25. !defined(BOOST_NO_SFINAE) && \
  26. !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) && \
  27. !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \
  28. !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
  29. !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && \
  30. !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) && !( \
  31. defined(BOOST_CLANG) && (1 == BOOST_CLANG) && ( \
  32. (__clang_major__ < 3) || ( \
  33. (3 == __clang_major__) && (__clang_minor__ < 2) \
  34. ) \
  35. ) \
  36. ) && !BOOST_WORKAROUND(BOOST_GCC, < 40900)
  37. #define BOOST_PARAMETER_HAS_PERFECT_FORWARDING
  38. #endif
  39. #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
  40. #if !defined(BOOST_PARAMETER_CAN_USE_MP11) && \
  41. !defined(BOOST_PARAMETER_DISABLE_MP11_USAGE) && \
  42. !defined(BOOST_NO_CXX11_CONSTEXPR) && \
  43. !defined(BOOST_NO_CXX11_DECLTYPE_N3276) && \
  44. !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && \
  45. !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && \
  46. !defined(BOOST_NO_CXX11_STATIC_ASSERT) && \
  47. !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) && \
  48. !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) && \
  49. !defined(BOOST_NO_CXX11_HDR_TUPLE)
  50. // Boost.MP11 requires C++11. -- Cromwell D. Enage
  51. #define BOOST_PARAMETER_CAN_USE_MP11
  52. #endif
  53. #if !defined(BOOST_PARAMETER_MAX_ARITY)
  54. // Unlike the variadic MPL sequences provided by Boost.Fusion,
  55. // boost::mpl::vector has a size limit. -- Cromwell D. Enage
  56. #include <boost/mpl/limits/vector.hpp>
  57. #define BOOST_PARAMETER_MAX_ARITY BOOST_MPL_LIMIT_VECTOR_SIZE
  58. #endif
  59. #else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
  60. #if !defined(BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
  61. #define BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY 0
  62. #endif
  63. #if !defined(BOOST_PARAMETER_COMPOSE_MAX_ARITY)
  64. #if BOOST_WORKAROUND(BOOST_MSVC, < 1800) || \
  65. BOOST_WORKAROUND(BOOST_GCC, < 60000)
  66. // Some tests cause MSVC-11.0 and earlier to run out of heap space,
  67. // while some other tests cause GCC 5 and earlier to do the same,
  68. // if the value is set any higher. -- Cromwell D. Enage
  69. #define BOOST_PARAMETER_COMPOSE_MAX_ARITY 20
  70. #else
  71. #define BOOST_PARAMETER_COMPOSE_MAX_ARITY 64
  72. #endif
  73. #endif // BOOST_PARAMETER_COMPOSE_MAX_ARITY
  74. #if !defined(BOOST_PARAMETER_MAX_ARITY)
  75. #define BOOST_PARAMETER_MAX_ARITY 8
  76. #endif
  77. #endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
  78. #endif // include guard