forked from boostorg/preprocessor
Added variadic is_empty and is_begin_parens along with tests.
This commit is contained in:
55
include/boost/preprocessor/facilities/detail/is_empty.hpp
Normal file
55
include/boost/preprocessor/facilities/detail/is_empty.hpp
Normal file
@ -0,0 +1,55 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Edward Diener 2014.
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See
|
||||
# * accompanying file LICENSE_1_0.txt or copy at
|
||||
# * http://www.boost.org/LICENSE_1_0.txt)
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
#ifndef BOOST_PREPROCESSOR_DETAIL_IS_EMPTY_HPP
|
||||
#define BOOST_PREPROCESSOR_DETAIL_IS_EMPTY_HPP
|
||||
|
||||
#include <boost/preprocessor/punctuation/is_begin_parens.hpp>
|
||||
|
||||
#if BOOST_PP_VARIADICS_MSVC
|
||||
|
||||
# pragma warning(once:4002)
|
||||
|
||||
#define BOOST_PP_DETAIL_IS_EMPTY_IIF_0(t, b) b
|
||||
#define BOOST_PP_DETAIL_IS_EMPTY_IIF_1(t, b) t
|
||||
|
||||
#else
|
||||
|
||||
#define BOOST_PP_DETAIL_IS_EMPTY_IIF_0(t, ...) __VA_ARGS__
|
||||
#define BOOST_PP_DETAIL_IS_EMPTY_IIF_1(t, ...) t
|
||||
|
||||
#endif
|
||||
|
||||
#if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400
|
||||
|
||||
#define BOOST_PP_DETAIL_IS_EMPTY_PROCESS(param) \
|
||||
BOOST_PP_IS_BEGIN_PARENS \
|
||||
( \
|
||||
BOOST_PP_DETAIL_IS_EMPTY_NON_FUNCTION_C param () \
|
||||
) \
|
||||
/**/
|
||||
|
||||
#else
|
||||
|
||||
#define BOOST_PP_DETAIL_IS_EMPTY_PROCESS(...) \
|
||||
BOOST_PP_IS_BEGIN_PARENS \
|
||||
( \
|
||||
BOOST_PP_DETAIL_IS_EMPTY_NON_FUNCTION_C __VA_ARGS__ () \
|
||||
) \
|
||||
/**/
|
||||
|
||||
#endif
|
||||
|
||||
#define BOOST_PP_DETAIL_IS_EMPTY_PRIMITIVE_CAT(a, b) a ## b
|
||||
#define BOOST_PP_DETAIL_IS_EMPTY_IIF(bit) BOOST_PP_DETAIL_IS_EMPTY_PRIMITIVE_CAT(BOOST_PP_DETAIL_IS_EMPTY_IIF_,bit)
|
||||
#define BOOST_PP_DETAIL_IS_EMPTY_NON_FUNCTION_C(...) ()
|
||||
|
||||
#endif /* BOOST_PREPROCESSOR_DETAIL_IS_EMPTY_HPP */
|
@ -1,6 +1,7 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2003.
|
||||
# * (C) Copyright Edward Diener 2014.
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See
|
||||
# * accompanying file LICENSE_1_0.txt or copy at
|
||||
# * http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -13,6 +14,14 @@
|
||||
# define BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_HPP
|
||||
#
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
#
|
||||
# if BOOST_PP_VARIADICS
|
||||
#
|
||||
# include <boost/preprocessor/facilities/is_empty_variadic.hpp>
|
||||
#
|
||||
# else
|
||||
#
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/tuple/elem.hpp>
|
||||
# include <boost/preprocessor/facilities/empty.hpp>
|
||||
@ -40,4 +49,6 @@
|
||||
# define BOOST_PP_IS_EMPTY_DEF_BOOST_PP_IS_EMPTY_HELPER 0, BOOST_PP_NIL
|
||||
# endif
|
||||
#
|
||||
# endif
|
||||
# endif /* BOOST_PP_VARIADICS */
|
||||
#
|
||||
# endif /* BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_HPP */
|
||||
|
56
include/boost/preprocessor/facilities/is_empty_variadic.hpp
Normal file
56
include/boost/preprocessor/facilities/is_empty_variadic.hpp
Normal file
@ -0,0 +1,56 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Edward Diener 2014.
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See
|
||||
# * accompanying file LICENSE_1_0.txt or copy at
|
||||
# * http://www.boost.org/LICENSE_1_0.txt)
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_VARIADIC_HPP
|
||||
# define BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_VARIADIC_HPP
|
||||
#
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
#
|
||||
# if BOOST_PP_VARIADICS
|
||||
#
|
||||
# include <boost/preprocessor/punctuation/is_begin_parens.hpp>
|
||||
# include <boost/preprocessor/facilities/detail/is_empty.hpp>
|
||||
#
|
||||
#define BOOST_PP_IS_EMPTY_GEN_ZERO(...) 0
|
||||
#if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400
|
||||
#
|
||||
#define BOOST_PP_IS_EMPTY(param) \
|
||||
BOOST_PP_DETAIL_IS_EMPTY_IIF \
|
||||
( \
|
||||
BOOST_PP_IS_BEGIN_PARENS \
|
||||
( \
|
||||
param \
|
||||
) \
|
||||
) \
|
||||
( \
|
||||
BOOST_PP_IS_EMPTY_GEN_ZERO, \
|
||||
BOOST_PP_DETAIL_IS_EMPTY_PROCESS \
|
||||
) \
|
||||
(param) \
|
||||
/**/
|
||||
# else
|
||||
#define BOOST_PP_IS_EMPTY(...) \
|
||||
BOOST_PP_DETAIL_IS_EMPTY_IIF \
|
||||
( \
|
||||
BOOST_PP_IS_BEGIN_PARENS \
|
||||
( \
|
||||
__VA_ARGS__ \
|
||||
) \
|
||||
) \
|
||||
( \
|
||||
BOOST_PP_IS_EMPTY_GEN_ZERO, \
|
||||
BOOST_PP_DETAIL_IS_EMPTY_PROCESS \
|
||||
) \
|
||||
(__VA_ARGS__) \
|
||||
/**/
|
||||
# endif /* BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 */
|
||||
# endif /* BOOST_PP_VARIADICS */
|
||||
# endif /* BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_VARIADIC_HPP */
|
@ -14,6 +14,7 @@
|
||||
#
|
||||
# include <boost/preprocessor/punctuation/comma.hpp>
|
||||
# include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||
# include <boost/preprocessor/punctuation/is_begin_parens.hpp>
|
||||
# include <boost/preprocessor/punctuation/paren.hpp>
|
||||
# include <boost/preprocessor/punctuation/paren_if.hpp>
|
||||
#
|
||||
|
@ -0,0 +1,48 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Edward Diener 2014.
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See
|
||||
# * accompanying file LICENSE_1_0.txt or copy at
|
||||
# * http://www.boost.org/LICENSE_1_0.txt)
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
#ifndef BOOST_PREPROCESSOR_DETAIL_IS_BEGIN_PARENS_HPP
|
||||
#define BOOST_PREPROCESSOR_DETAIL_IS_BEGIN_PARENS_HPP
|
||||
|
||||
#if BOOST_PP_VARIADICS_MSVC
|
||||
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
|
||||
#define BOOST_PP_DETAIL_VD_IBP_CAT(a, b) BOOST_PP_DETAIL_VD_IBP_CAT_I(a, b)
|
||||
#define BOOST_PP_DETAIL_VD_IBP_CAT_I(a, b) BOOST_PP_DETAIL_VD_IBP_CAT_II(a ## b)
|
||||
#define BOOST_PP_DETAIL_VD_IBP_CAT_II(res) res
|
||||
|
||||
#define BOOST_PP_DETAIL_IBP_SPLIT(i, ...) \
|
||||
BOOST_PP_DETAIL_VD_IBP_CAT(BOOST_PP_DETAIL_IBP_PRIMITIVE_CAT(BOOST_PP_DETAIL_IBP_SPLIT_,i)(__VA_ARGS__),BOOST_PP_EMPTY()) \
|
||||
/**/
|
||||
|
||||
#define BOOST_PP_DETAIL_IBP_IS_VARIADIC_C(...) 1 1
|
||||
|
||||
#else
|
||||
|
||||
#define BOOST_PP_DETAIL_IBP_SPLIT(i, ...) \
|
||||
BOOST_PP_DETAIL_IBP_PRIMITIVE_CAT(BOOST_PP_DETAIL_IBP_SPLIT_,i)(__VA_ARGS__) \
|
||||
/**/
|
||||
|
||||
#define BOOST_PP_DETAIL_IBP_IS_VARIADIC_C(...) 1
|
||||
|
||||
#endif /* BOOST_PP_VARIADICS_MSVC */
|
||||
|
||||
#define BOOST_PP_DETAIL_IBP_SPLIT_0(a, ...) a
|
||||
#define BOOST_PP_DETAIL_IBP_SPLIT_1(a, ...) __VA_ARGS__
|
||||
|
||||
#define BOOST_PP_DETAIL_IBP_CAT(a, ...) BOOST_PP_DETAIL_IBP_PRIMITIVE_CAT(a,__VA_ARGS__)
|
||||
#define BOOST_PP_DETAIL_IBP_PRIMITIVE_CAT(a, ...) a ## __VA_ARGS__
|
||||
|
||||
#define BOOST_PP_DETAIL_IBP_IS_VARIADIC_R_1 1,
|
||||
#define BOOST_PP_DETAIL_IBP_IS_VARIADIC_R_BOOST_PP_DETAIL_IBP_IS_VARIADIC_C 0,
|
||||
|
||||
#endif /* BOOST_PREPROCESSOR_DETAIL_IS_BEGIN_PARENS_HPP */
|
51
include/boost/preprocessor/punctuation/is_begin_parens.hpp
Normal file
51
include/boost/preprocessor/punctuation/is_begin_parens.hpp
Normal file
@ -0,0 +1,51 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Edward Diener 2014.
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See
|
||||
# * accompanying file LICENSE_1_0.txt or copy at
|
||||
# * http://www.boost.org/LICENSE_1_0.txt)
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_IS_BEGIN_PARENS_HPP
|
||||
# define BOOST_PREPROCESSOR_IS_BEGIN_PARENS_HPP
|
||||
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
|
||||
#if BOOST_PP_VARIADICS
|
||||
|
||||
#include <boost/preprocessor/punctuation/detail/is_begin_parens.hpp>
|
||||
|
||||
#if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400
|
||||
|
||||
#define BOOST_PP_IS_BEGIN_PARENS(param) \
|
||||
BOOST_PP_DETAIL_IBP_SPLIT \
|
||||
( \
|
||||
0, \
|
||||
BOOST_PP_DETAIL_IBP_CAT \
|
||||
( \
|
||||
BOOST_PP_DETAIL_IBP_IS_VARIADIC_R_, \
|
||||
BOOST_PP_DETAIL_IBP_IS_VARIADIC_C param \
|
||||
) \
|
||||
) \
|
||||
/**/
|
||||
|
||||
#else
|
||||
|
||||
#define BOOST_PP_IS_BEGIN_PARENS(...) \
|
||||
BOOST_PP_DETAIL_IBP_SPLIT \
|
||||
( \
|
||||
0, \
|
||||
BOOST_PP_DETAIL_IBP_CAT \
|
||||
( \
|
||||
BOOST_PP_DETAIL_IBP_IS_VARIADIC_R_, \
|
||||
BOOST_PP_DETAIL_IBP_IS_VARIADIC_C __VA_ARGS__ \
|
||||
) \
|
||||
) \
|
||||
/**/
|
||||
|
||||
#endif /* BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 */
|
||||
#endif /* BOOST_PP_VARIADICS */
|
||||
#endif /* BOOST_PREPROCESSOR_IS_BEGIN_PARENS_HPP */
|
Reference in New Issue
Block a user