Added OPT macro to determine whether C++20's __VA_OPT__ is supported or not. Updated the undocumented variadic IS_EMPTY to use the functionality of __VA_OPT__ if it exists to provide perfect functionality for testing for emptiness.

This commit is contained in:
Edward Diener
2019-09-25 06:29:04 -04:00
parent c436de6142
commit e476f10f52
11 changed files with 167 additions and 24 deletions

View File

@ -16,6 +16,20 @@
#
# if BOOST_PP_VARIADICS
#
# include <boost/preprocessor/variadic/opt.hpp>
#
# if BOOST_PP_VARIADIC_OPT()
#
#define BOOST_PP_IS_EMPTY_FUNCTION2(...) \
__VA_OPT__(0,) 1 \
/**/
#define BOOST_PP_IS_EMPTY_FUNCTION(...) \
BOOST_PP_IS_EMPTY_FUNCTION2(__VA_ARGS__) \
/**/
#define BOOST_PP_IS_EMPTY(...) \
BOOST_PP_VARIADIC_OPT_ELEM0(BOOST_PP_IS_EMPTY_FUNCTION(__VA_ARGS__),) \
/**/
# else
# include <boost/preprocessor/punctuation/is_begin_parens.hpp>
# include <boost/preprocessor/facilities/detail/is_empty.hpp>
#
@ -53,5 +67,6 @@
/**/
#define BOOST_PP_IS_EMPTY_ZERO(...) 0
# endif /* BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 */
# endif /* BOOST_PP_VARIADIC_OPT() */
# endif /* BOOST_PP_VARIADICS */
# endif /* BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_VARIADIC_HPP */