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