Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:38

0001 
0002 //  (C) Copyright Edward Diener 2011-2015,2019
0003 //  Use, modification and distribution are subject to the Boost Software License,
0004 //  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0005 //  http://www.boost.org/LICENSE_1_0.txt).
0006 
0007 #if !defined(BOOST_VMD_IS_EMPTY_HPP)
0008 #define BOOST_VMD_IS_EMPTY_HPP
0009 
0010 #include <boost/vmd/detail/setup.hpp>
0011 
0012 #if BOOST_PP_VARIADICS
0013 
0014 #include <boost/preprocessor/punctuation/is_begin_parens.hpp>
0015 #include <boost/vmd/detail/is_empty.hpp>
0016 
0017 /*
0018 
0019   The succeeding comments in this file are in doxygen format.
0020 
0021 */
0022 
0023 /** \file
0024 */
0025 
0026 /** \def BOOST_VMD_IS_EMPTY(...)
0027 
0028     \brief Tests whether its input is empty or not.
0029 
0030     The macro checks to see if the input is empty or not.
0031     It returns 1 if the input is empty, else returns 0.
0032     
0033     The macro is a variadic macro taking any input.
0034     For the VC++8 compiler (VS2005) the macro takes a single parameter of input to check.
0035     
0036     For all levels of C++ prior to C++20 the macro is not perfect, 
0037     and can not be so. The problem area is if the input to be
0038     checked is a function-like macro name, in which case either
0039     a compiler error can result or a false result can occur.
0040     
0041     For C++20, with its support for the new __VA_OPT__ preprocessor
0042     construct, the macro will always work correctly no matter what
0043     the variadic input, and is therefore 100% reliable.
0044     
0045     This macro is a replacement, using variadic macro support,
0046     for the undocumented macro BOOST_PP_IS_EMPTY in the Boost
0047     PP library. The code is taken from a posting by Paul Mensonides
0048     of a variadic version for BOOST_PP_IS_EMPTY, and changed 
0049     in order to also support VC++. The code for the C++20
0050     implementation of the macro, using the __VA_OPT__ preprocessor
0051     construct, is the author's own and reuses code added to the
0052     Boost preprocessor library by this author.
0053     
0054     ... = variadic input, for VC++8 this must be a single parameter
0055 
0056     returns = 1 if the input is empty, 0 if it is not
0057     
0058     It is recommended to append BOOST_PP_EMPTY() to whatever input
0059     is being tested in order to avoid possible warning messages 
0060     from some compilers about no parameters being passed to the macro
0061     when the input is truly empty.
0062     
0063 */
0064 
0065 #if BOOST_VMD_MSVC_V8
0066 
0067 #define BOOST_VMD_IS_EMPTY(sequence) \
0068     BOOST_VMD_DETAIL_IS_EMPTY_IIF \
0069       ( \
0070       BOOST_PP_IS_BEGIN_PARENS \
0071         ( \
0072         sequence \
0073         ) \
0074       ) \
0075       ( \
0076       BOOST_VMD_DETAIL_IS_EMPTY_GEN_ZERO, \
0077       BOOST_VMD_DETAIL_IS_EMPTY_PROCESS \
0078       ) \
0079     (sequence) \
0080 /**/
0081 
0082 #else
0083 
0084 # if defined(__cplusplus) && __cplusplus > 201703L
0085 #include <boost/preprocessor/variadic/has_opt.hpp>
0086 #include <boost/preprocessor/facilities/is_empty.hpp>
0087 #define BOOST_VMD_IS_EMPTY(...) \
0088     BOOST_VMD_DETAIL_IS_EMPTY_IIF \
0089       ( \
0090       BOOST_PP_VARIADIC_HAS_OPT() \
0091       ) \
0092       ( \
0093       BOOST_PP_IS_EMPTY_OPT, \
0094       BOOST_VMD_IS_EMPTY_NO_OPT \
0095       ) \
0096     (__VA_ARGS__) \
0097 /**/
0098 # else
0099 #define BOOST_VMD_IS_EMPTY(...) \
0100     BOOST_VMD_IS_EMPTY_NO_OPT(__VA_ARGS__) \
0101 /**/
0102 # endif
0103 #define BOOST_VMD_IS_EMPTY_NO_OPT(...) \
0104     BOOST_VMD_DETAIL_IS_EMPTY_IIF \
0105       ( \
0106       BOOST_PP_IS_BEGIN_PARENS \
0107         ( \
0108         __VA_ARGS__ \
0109         ) \
0110       ) \
0111       ( \
0112       BOOST_VMD_DETAIL_IS_EMPTY_GEN_ZERO, \
0113       BOOST_VMD_DETAIL_IS_EMPTY_PROCESS \
0114       ) \
0115     (__VA_ARGS__) \
0116 /**/
0117 #endif /* BOOST_VMD_MSVC_V8 */
0118 #endif /* BOOST_PP_VARIADICS */
0119 #endif /* BOOST_VMD_IS_EMPTY_HPP */