From ff4944f0ec6122d7d3a36a09f20975c04ef1c25b Mon Sep 17 00:00:00 2001 From: Bruno Dutra Date: Sun, 8 Feb 2015 17:07:22 -0200 Subject: [PATCH 1/4] using BOOST_PP_ENUM_PARAMS to generate base seq accordingly hardcoding a base seq from 0 to 9 was the culprit behind Ticket #7769 --- include/boost/mpl/aux_/preprocessor/range.hpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/include/boost/mpl/aux_/preprocessor/range.hpp b/include/boost/mpl/aux_/preprocessor/range.hpp index 54094ee..adc1f46 100644 --- a/include/boost/mpl/aux_/preprocessor/range.hpp +++ b/include/boost/mpl/aux_/preprocessor/range.hpp @@ -15,9 +15,23 @@ // $Revision$ #include +#include +#include +#include +#include +#include +#undef BOOST_MPL_PP_RANGE #define BOOST_MPL_PP_RANGE(first, length) \ - BOOST_PP_SEQ_SUBSEQ((0)(1)(2)(3)(4)(5)(6)(7)(8)(9), first, length) \ + BOOST_PP_SEQ_SUBSEQ( \ + BOOST_PP_TUPLE_TO_SEQ( \ + BOOST_PP_ADD(first, length), \ + BOOST_PP_LPAREN() \ + BOOST_PP_ENUM_PARAMS(BOOST_PP_ADD(first, length), BOOST_PP_EMPTY()) \ + BOOST_PP_RPAREN() \ + ), \ + first, length \ + ) \ /**/ #endif // BOOST_MPL_AUX_PREPROCESSOR_RANGE_HPP_INCLUDED From 6fd793c787fa74c23306df208ef9de539040c29d Mon Sep 17 00:00:00 2001 From: Bruno Dutra Date: Sun, 8 Feb 2015 19:14:55 -0200 Subject: [PATCH 2/4] keeping it simple --- include/boost/mpl/aux_/preprocessor/range.hpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/include/boost/mpl/aux_/preprocessor/range.hpp b/include/boost/mpl/aux_/preprocessor/range.hpp index adc1f46..d66eeb5 100644 --- a/include/boost/mpl/aux_/preprocessor/range.hpp +++ b/include/boost/mpl/aux_/preprocessor/range.hpp @@ -15,21 +15,14 @@ // $Revision$ #include -#include +#include #include -#include -#include -#include -#undef BOOST_MPL_PP_RANGE +#define BOOST_MPL_PP_RANGE_ITEM(z,n,_) (n) + #define BOOST_MPL_PP_RANGE(first, length) \ BOOST_PP_SEQ_SUBSEQ( \ - BOOST_PP_TUPLE_TO_SEQ( \ - BOOST_PP_ADD(first, length), \ - BOOST_PP_LPAREN() \ - BOOST_PP_ENUM_PARAMS(BOOST_PP_ADD(first, length), BOOST_PP_EMPTY()) \ - BOOST_PP_RPAREN() \ - ), \ + BOOST_PP_REPEAT(BOOST_PP_ADD(first,length), BOOST_MPL_PP_RANGE_ITEM, _), \ first, length \ ) \ /**/ From faf17ec8586d7dc8e69df88d1105f82177fce3f3 Mon Sep 17 00:00:00 2001 From: Bruno Dutra Date: Sat, 21 Feb 2015 23:15:38 -0300 Subject: [PATCH 3/4] Adding test cases for a scenario of increased arity limit Test cases are based on calling apply to forward to the and_ predicate an increasing number, from 2 to 15, of true_ constants. Since the arity limit on the current version is set to 5, BOOST_MPL_LIMIT_METAFUNCTION_ARITY and BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS must be appropriately set. --- test/aux_/increased_arity.cpp | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 test/aux_/increased_arity.cpp diff --git a/test/aux_/increased_arity.cpp b/test/aux_/increased_arity.cpp new file mode 100644 index 0000000..d5c216d --- /dev/null +++ b/test/aux_/increased_arity.cpp @@ -0,0 +1,50 @@ + +// Copyright Bruno Dutra 2015 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_LIMIT_METAFUNCTION_ARITY 15 +#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#define TEST_N_ARY(unused1, N, unused2) \ + struct BOOST_PP_CAT(_, BOOST_PP_CAT(N, _ary)) \ + { \ + MPL_ASSERT(( \ + apply< \ + and_, \ + BOOST_PP_ENUM_PARAMS(N, true_ BOOST_PP_INTERCEPT) \ + > \ + )); \ + }; \ +/**/ + +MPL_TEST_CASE() +{ + BOOST_PP_REPEAT_FROM_TO( + 2, + BOOST_PP_INC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY), + TEST_N_ARY, + _ + ) +} From feb7835e62aad7417509b66f5a6db17322104619 Mon Sep 17 00:00:00 2001 From: Bruno Dutra Date: Sat, 21 Feb 2015 23:19:03 -0300 Subject: [PATCH 4/4] Adding newly added test to the Jamfile --- test/Jamfile.v2 | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 0031a52..6a88a6a 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -1,4 +1,5 @@ +compile aux_/increased_arity.cpp ; compile aux_/largest_int.cpp ; compile aux_/msvc_is_class.cpp ; compile aux_/template_arity.cpp ;