Added BOOST_PP_IDENTITY_N functionality with test.

This commit is contained in:
Edward Diener
2015-09-12 19:53:59 -04:00
parent 132eb67cec
commit 735e301c46
3 changed files with 15 additions and 1 deletions

View File

@ -8,6 +8,7 @@
# */ # */
# #
# /* Revised by Paul Mensonides (2002) */ # /* Revised by Paul Mensonides (2002) */
# /* Revised by Edward Diener (2015) */
# #
# /* See http://www.boost.org for most recent version. */ # /* See http://www.boost.org for most recent version. */
# #
@ -15,9 +16,12 @@
# define BOOST_PREPROCESSOR_FACILITIES_IDENTITY_HPP # define BOOST_PREPROCESSOR_FACILITIES_IDENTITY_HPP
# #
# include <boost/preprocessor/facilities/empty.hpp> # include <boost/preprocessor/facilities/empty.hpp>
# include <boost/preprocessor/tuple/eat.hpp>
# #
# /* BOOST_PP_IDENTITY */ # /* BOOST_PP_IDENTITY */
# #
# define BOOST_PP_IDENTITY(item) item BOOST_PP_EMPTY # define BOOST_PP_IDENTITY(item) item BOOST_PP_EMPTY
# #
# define BOOST_PP_IDENTITY_N(item,n) item BOOST_PP_TUPLE_EAT_N(n)
#
# endif # endif

View File

@ -8,7 +8,7 @@
# */ # */
# #
# /* Revised by Paul Mensonides (2002-2011) */ # /* Revised by Paul Mensonides (2002-2011) */
# /* Revised by Edward Diener (2011) */ # /* Revised by Edward Diener (2011,2015) */
# #
# /* See http://www.boost.org for most recent version. */ # /* See http://www.boost.org for most recent version. */
# #
@ -38,6 +38,15 @@
# endif # endif
# define BOOST_PP_TUPLE_EAT_I(size) BOOST_PP_TUPLE_EAT_ ## size # define BOOST_PP_TUPLE_EAT_I(size) BOOST_PP_TUPLE_EAT_ ## size
# endif # endif
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
# define BOOST_PP_TUPLE_EAT_N(size) BOOST_PP_TUPLE_EAT_N_I(size)
# else
# define BOOST_PP_TUPLE_EAT_N(size) BOOST_PP_TUPLE_EAT_N_OO((size))
# define BOOST_PP_TUPLE_EAT_N_OO(par) BOOST_PP_TUPLE_EAT_N_I ## par
# endif
# define BOOST_PP_TUPLE_EAT_N_I(size) BOOST_PP_TUPLE_EAT_ ## size
#
# define BOOST_PP_TUPLE_EAT_1(e0) # define BOOST_PP_TUPLE_EAT_1(e0)
# define BOOST_PP_TUPLE_EAT_2(e0, e1) # define BOOST_PP_TUPLE_EAT_2(e0, e1)
# define BOOST_PP_TUPLE_EAT_3(e0, e1, e2) # define BOOST_PP_TUPLE_EAT_3(e0, e1, e2)

View File

@ -26,6 +26,7 @@ BEGIN BOOST_PP_APPLY((BOOST_PP_EMPTY))() 0 == 0 END
BEGIN BOOST_PP_EXPAND(MACRO ARGS) == 1 END BEGIN BOOST_PP_EXPAND(MACRO ARGS) == 1 END
BEGIN BOOST_PP_IDENTITY(1)() == 1 END BEGIN BOOST_PP_IDENTITY(1)() == 1 END
BEGIN BOOST_PP_IDENTITY_N(36,10)(0,1,2,3,4,5,6,7,8,9) == 36 END
BEGIN BOOST_PP_CAT(BOOST_PP_INTERCEPT, 2) 1 == 1 END BEGIN BOOST_PP_CAT(BOOST_PP_INTERCEPT, 2) 1 == 1 END