Addition of is_empty tests and changes to rem processing as a workaround to VC++ problem.

This commit is contained in:
Edward Diener
2014-04-30 16:06:49 -04:00
parent 2c7cf9410a
commit 4ed6f6e07a
24 changed files with 476 additions and 66 deletions

View File

@ -22,9 +22,7 @@
# include <boost/preprocessor/variadic/elem.hpp>
#
# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC
# include <boost/preprocessor/comparison/equal.hpp>
# include <boost/preprocessor/control/iif.hpp>
# include <boost/preprocessor/tuple/size.hpp>
# include <boost/preprocessor/tuple/detail/is_single_return.hpp>
# endif
#
# if BOOST_PP_VARIADICS
@ -33,21 +31,12 @@
# define BOOST_PP_TUPLE_ELEM_I(m, args) BOOST_PP_TUPLE_ELEM_II(m, args)
# define BOOST_PP_TUPLE_ELEM_II(m, args) BOOST_PP_CAT(m ## args,)
/*
Use BOOST_PP_TUPLE_ELEM_O_2_CAT if it is a single element tuple ( which might be empty )
Use BOOST_PP_REM_CAT if it is a single element tuple ( which might be empty )
else use BOOST_PP_REM. This fixes a VC++ problem with an empty tuple and BOOST_PP_TUPLE_ELEM
functionality.
functionality. See tuple_elem_bug_test.cxx.
*/
# define BOOST_PP_TUPLE_ELEM_O_2_CAT(...) BOOST_PP_CAT(__VA_ARGS__,)
# define BOOST_PP_TUPLE_ELEM_O_2_SINGLE(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_TUPLE_ELEM_O_2_CAT tuple)
# define BOOST_PP_TUPLE_ELEM_O_2_ANY(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_REM tuple)
# define BOOST_PP_TUPLE_ELEM_O_2(n, tuple) \
BOOST_PP_IIF \
( \
BOOST_PP_EQUAL(BOOST_PP_TUPLE_SIZE(tuple),1), \
BOOST_PP_TUPLE_ELEM_O_2_SINGLE, \
BOOST_PP_TUPLE_ELEM_O_2_ANY \
) \
(n, tuple) \
BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_TUPLE_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,tuple) tuple) \
/**/
# else
# define BOOST_PP_TUPLE_ELEM(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_ELEM_O_, __VA_ARGS__)(__VA_ARGS__)