Fixes for empty conversions and tests for empty conversions.

This commit is contained in:
Edward Diener
2014-05-04 03:07:00 -04:00
parent 70e775452a
commit 697ebcd840
7 changed files with 96 additions and 14 deletions

View File

@ -15,19 +15,33 @@
#
# include <boost/preprocessor/cat.hpp>
# include <boost/preprocessor/config/config.hpp>
# include <boost/preprocessor/array/size.hpp>
# include <boost/preprocessor/control/if.hpp>
# include <boost/preprocessor/tuple/to_list.hpp>
#
# /* BOOST_PP_ARRAY_TO_LIST */
#
# define BOOST_PP_ARRAY_TO_LIST(array) \
BOOST_PP_IF \
( \
BOOST_PP_ARRAY_SIZE(array), \
BOOST_PP_ARRAY_TO_LIST_DO, \
BOOST_PP_ARRAY_TO_LIST_EMPTY \
) \
(array) \
/**/
#
# define BOOST_PP_ARRAY_TO_LIST_EMPTY(array) BOOST_PP_NIL
#
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
# define BOOST_PP_ARRAY_TO_LIST(array) BOOST_PP_ARRAY_TO_LIST_I(BOOST_PP_TUPLE_TO_LIST, array)
# define BOOST_PP_ARRAY_TO_LIST_DO(array) BOOST_PP_ARRAY_TO_LIST_I(BOOST_PP_TUPLE_TO_LIST, array)
# define BOOST_PP_ARRAY_TO_LIST_I(m, args) BOOST_PP_ARRAY_TO_LIST_II(m, args)
# define BOOST_PP_ARRAY_TO_LIST_II(m, args) BOOST_PP_CAT(m ## args,)
# elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
# define BOOST_PP_ARRAY_TO_LIST(array) BOOST_PP_ARRAY_TO_LIST_I(array)
# define BOOST_PP_ARRAY_TO_LIST_DO(array) BOOST_PP_ARRAY_TO_LIST_I(array)
# define BOOST_PP_ARRAY_TO_LIST_I(array) BOOST_PP_TUPLE_TO_LIST ## array
# else
# define BOOST_PP_ARRAY_TO_LIST(array) BOOST_PP_TUPLE_TO_LIST array
# define BOOST_PP_ARRAY_TO_LIST_DO(array) BOOST_PP_TUPLE_TO_LIST array
# endif
#
# endif

View File

@ -21,10 +21,27 @@
# include <boost/preprocessor/tuple/elem.hpp>
# include <boost/preprocessor/tuple/rem.hpp>
# include <boost/preprocessor/array/detail/get_data.hpp>
# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && (_MSC_VER <= 1400)
# include <boost/preprocessor/control/iif.hpp>
# endif
#
# /* BOOST_PP_LIST_TO_ARRAY */
#
# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && (_MSC_VER <= 1400)
# define BOOST_PP_LIST_TO_ARRAY(list) \
BOOST_PP_IIF \
( \
BOOST_PP_LIST_IS_NIL(list), \
BOOST_PP_LIST_TO_ARRAY_VC8ORLESS_EMPTY, \
BOOST_PP_LIST_TO_ARRAY_VC8ORLESS_DO \
) \
(list) \
/**/
# define BOOST_PP_LIST_TO_ARRAY_VC8ORLESS_EMPTY(list) (0,())
# define BOOST_PP_LIST_TO_ARRAY_VC8ORLESS_DO(list) BOOST_PP_LIST_TO_ARRAY_I(BOOST_PP_WHILE, list)
# else
# define BOOST_PP_LIST_TO_ARRAY(list) BOOST_PP_LIST_TO_ARRAY_I(BOOST_PP_WHILE, list)
# endif
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
# define BOOST_PP_LIST_TO_ARRAY_I(w, list) \

View File

@ -48,6 +48,9 @@
# endif
# endif
#
/* An empty array can be passed */
# define BOOST_PP_TUPLE_TO_SEQ_0() ()
#
# define BOOST_PP_TUPLE_TO_SEQ_1(e0) (e0)
# define BOOST_PP_TUPLE_TO_SEQ_2(e0, e1) (e0)(e1)
# define BOOST_PP_TUPLE_TO_SEQ_3(e0, e1, e2) (e0)(e1)(e2)