1
0
forked from boostorg/mpl

It normally should not be necessary to use the _Z form of the BOOST_P… (#52)

* It normally should not be necessary to use the _Z form of the BOOST_PP_ENUM macro, although it is perfectly legal and helpful to do so, but in this case it is necessary as a workaround for a bug in the new VC++ standard conforming preprocessor. The bug manifests itself when testing the TTI library, which internally uses the Boost MPL code. The bug in the new VC++ standard conforming compiler is fixed in the VS2019 preview product, so that fix is sure to find its way to the official VS2019 product sometime soon. In the meantime this "fix" shortens the macro expansion somewhat and, while it should not be necessary, is still helpful.

* Fix for appveyor.yml file

* Added VS2019 tests, also with new preprocessor. Further MPL Fixes for new preprocessor bug, which are also useful and will speed up preprocessing.

* Can't seem to test msvc-10.0 or msvc-11.0 any more with Appveyor

* Update description
This commit is contained in:
Edward Diener
2020-09-24 06:07:26 -04:00
committed by GitHub
parent 9c0f98f088
commit 6704b09dcf
7 changed files with 64 additions and 26 deletions

View File

@@ -29,6 +29,10 @@
BOOST_PP_CAT(BOOST_MPL_PP_ENUM_,n)(param) \
/**/
# define BOOST_MPL_PP_ENUM_Z(z_ignored, n, param) \
BOOST_PP_CAT(BOOST_MPL_PP_ENUM_,n)(param) \
/**/
# define BOOST_MPL_PP_ENUM_0(p)
# define BOOST_MPL_PP_ENUM_1(p) p
# define BOOST_MPL_PP_ENUM_2(p) p,p
@@ -57,6 +61,14 @@
) \
/**/
# define BOOST_MPL_PP_ENUM_Z(z, n, param) \
BOOST_PP_REPEAT_ ## z( \
n \
, BOOST_MPL_PP_AUX_ENUM_FUNC \
, param \
) \
/**/
#endif
#endif // BOOST_MPL_AUX_PREPROCESSOR_ENUM_HPP_INCLUDED

View File

@@ -29,6 +29,10 @@
BOOST_PP_CAT(BOOST_MPL_PP_PARAMS_,n)(p) \
/**/
# define BOOST_MPL_PP_PARAMS_Z(z_ignored,n,p) \
BOOST_PP_CAT(BOOST_MPL_PP_PARAMS_,n)(p) \
/**/
# define BOOST_MPL_PP_PARAMS_0(p)
# define BOOST_MPL_PP_PARAMS_1(p) p##1
# define BOOST_MPL_PP_PARAMS_2(p) p##1,p##2
@@ -60,6 +64,14 @@
) \
/**/
# define BOOST_MPL_PP_PARAMS_Z(z, n, param) \
BOOST_PP_REPEAT_ ## z( \
n \
, BOOST_MPL_PP_AUX_PARAM_FUNC \
, param \
) \
/**/
#endif
#endif // BOOST_MPL_AUX_PREPROCESSOR_PARAMS_HPP_INCLUDED

View File

@@ -334,7 +334,7 @@ struct trait \
// correct name but different number of arguments.
# define BOOST_MPL_HAS_MEMBER_MULTI_SUBSTITUTE(z, n, args) \
template< \
template< BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n), typename V) > class V \
template< BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(n), typename V) > class V \
> \
struct BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_NAME(args, n) { \
}; \
@@ -503,7 +503,7 @@ struct trait \
z, n, args \
) \
template< \
template< BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n), typename U) > class U \
template< BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(n), typename U) > class U \
> \
struct BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_NAME_WITH_TEMPLATE_SFINAE( \
args, n \

View File

@@ -500,11 +500,11 @@ namespace boost { namespace mpl
};
#define M0(z, n, data) \
template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C), int J> \
struct string_iterator<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, n, J> \
template<BOOST_PP_ENUM_PARAMS_Z(z, BOOST_MPL_STRING_MAX_PARAMS, int C), int J> \
struct string_iterator<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, BOOST_MPL_STRING_MAX_PARAMS, C)>, n, J> \
{ \
enum { eomc_ = (BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C, n)) == J + 1) }; \
typedef mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)> string; \
typedef mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, BOOST_MPL_STRING_MAX_PARAMS, C)> string; \
typedef std::bidirectional_iterator_tag category; \
typedef \
mpl::string_iterator<string, n + eomc_, eomc_ ? 0 : J + 1> \
@@ -514,11 +514,11 @@ namespace boost { namespace mpl
prior; \
typedef mpl::char_<BOOST_MPL_MULTICHAR_AT(BOOST_PP_CAT(C, n), J)> type; \
}; \
template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C)> \
struct string_iterator<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, n, 0> \
template<BOOST_PP_ENUM_PARAMS_Z(z, BOOST_MPL_STRING_MAX_PARAMS, int C)> \
struct string_iterator<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, BOOST_MPL_STRING_MAX_PARAMS, C)>, n, 0> \
{ \
enum { eomc_ = (BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C, n)) == 1) }; \
typedef mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)> string; \
typedef mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, BOOST_MPL_STRING_MAX_PARAMS, C)> string; \
typedef std::bidirectional_iterator_tag category; \
typedef \
mpl::string_iterator<string, n + eomc_, !eomc_> \