1 | |
2 | // (C) Copyright Edward Diener 2011-2015 |
3 | // Use, modification and distribution are subject to the Boost Software License, |
4 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
5 | // http://www.boost.org/LICENSE_1_0.txt). |
6 | |
7 | #if !defined(BOOST_VMD_IS_EMPTY_HPP) |
8 | #define BOOST_VMD_IS_EMPTY_HPP |
9 | |
10 | #include <boost/vmd/detail/setup.hpp> |
11 | |
12 | #if BOOST_PP_VARIADICS |
13 | |
14 | #include <boost/preprocessor/punctuation/is_begin_parens.hpp> |
15 | #include <boost/vmd/detail/is_empty.hpp> |
16 | |
17 | /* |
18 | |
19 | The succeeding comments in this file are in doxygen format. |
20 | |
21 | */ |
22 | |
23 | /** \file |
24 | */ |
25 | |
26 | /** \def BOOST_VMD_IS_EMPTY(...) |
27 | |
28 | \brief Tests whether its input is empty or not. |
29 | |
30 | The macro checks to see if the input is empty or not. |
31 | It returns 1 if the input is empty, else returns 0. |
32 | |
33 | The macro is a variadic macro taking any input. |
34 | For the VC++8 compiler (VS2005) the macro takes a single parameter of input to check. |
35 | |
36 | The macro is not perfect, and can not be so. The problem |
37 | area is if the input to be checked is a function-like |
38 | macro name, in which case either a compiler error can result |
39 | or a false result can occur. |
40 | |
41 | This macro is a replacement, using variadic macro support, |
42 | for the undocumented macro BOOST_PP_IS_EMPTY in the Boost |
43 | PP library. The code is taken from a posting by Paul Mensonides |
44 | of a variadic version for BOOST_PP_IS_EMPTY, and changed |
45 | in order to also support VC++. |
46 | |
47 | .... = variadic input, for VC++8 this must be a single parameter |
48 | |
49 | returns = 1 if the input is empty, 0 if it is not |
50 | |
51 | It is recommended to append BOOST_PP_EMPTY() to whatever input |
52 | is being tested in order to avoid possible warning messages |
53 | from some compilers about no parameters being passed to the macro |
54 | when the input is truly empty. |
55 | |
56 | */ |
57 | |
58 | #if BOOST_VMD_MSVC_V8 |
59 | |
60 | #define BOOST_VMD_IS_EMPTY(sequence) \ |
61 | BOOST_VMD_DETAIL_IS_EMPTY_IIF \ |
62 | ( \ |
63 | BOOST_PP_IS_BEGIN_PARENS \ |
64 | ( \ |
65 | sequence \ |
66 | ) \ |
67 | ) \ |
68 | ( \ |
69 | BOOST_VMD_DETAIL_IS_EMPTY_GEN_ZERO, \ |
70 | BOOST_VMD_DETAIL_IS_EMPTY_PROCESS \ |
71 | ) \ |
72 | (sequence) \ |
73 | /**/ |
74 | |
75 | #else |
76 | |
77 | #define BOOST_VMD_IS_EMPTY(...) \ |
78 | BOOST_VMD_DETAIL_IS_EMPTY_IIF \ |
79 | ( \ |
80 | BOOST_PP_IS_BEGIN_PARENS \ |
81 | ( \ |
82 | __VA_ARGS__ \ |
83 | ) \ |
84 | ) \ |
85 | ( \ |
86 | BOOST_VMD_DETAIL_IS_EMPTY_GEN_ZERO, \ |
87 | BOOST_VMD_DETAIL_IS_EMPTY_PROCESS \ |
88 | ) \ |
89 | (__VA_ARGS__) \ |
90 | /**/ |
91 | |
92 | #endif /* BOOST_VMD_MSVC_V8 */ |
93 | |
94 | #endif /* BOOST_PP_VARIADICS */ |
95 | #endif /* BOOST_VMD_IS_EMPTY_HPP */ |
96 | |