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).
7 #if !defined(BOOST_VMD_IS_EMPTY_ARRAY_HPP)
8 #define BOOST_VMD_IS_EMPTY_ARRAY_HPP
10 #include <boost/vmd/detail/setup.hpp>
12 #if BOOST_PP_VARIADICS
14 #include <boost/preprocessor/control/iif.hpp>
15 #include <boost/vmd/is_array.hpp>
16 #include <boost/vmd/identity.hpp>
17 #include <boost/vmd/detail/is_empty_array.hpp>
21 The succeeding comments in this file are in doxygen format.
28 /** \def BOOST_VMD_IS_EMPTY_ARRAY(sequence)
30 \brief Tests whether a sequence is an empty Boost PP array.
32 An empty Boost PP array is a two element tuple where the first
33 size element is 0 and the second element is a tuple with a single
34 empty element, ie. '(0,())'.
36 sequence = a possible empty array
38 returns = 1 if the sequence is an empty Boost PP array
41 The macro will generate a preprocessing error if the sequence
42 is in the form of an array but its first tuple element, instead
43 of being a number, is a preprocessor token which VMD cannot parse,
44 as in the example '(&0,())' which is a valid tuple but an invalid
49 #define BOOST_VMD_IS_EMPTY_ARRAY(sequence) \
50 BOOST_VMD_IDENTITY_RESULT \
54 BOOST_VMD_IS_ARRAY(sequence), \
55 BOOST_VMD_DETAIL_IS_EMPTY_ARRAY_SIZE, \
56 BOOST_VMD_IDENTITY(0) \
62 /** \def BOOST_VMD_IS_EMPTY_ARRAY_D(d,sequence)
64 \brief Tests whether a sequence is an empty Boost PP array. Re-entrant version.
66 An empty Boost PP array is a two element tuple where the first
67 size element is 0 and the second element is a tuple with a single
68 empty element, ie. '(0,())'.
70 d = The next available BOOST_PP_WHILE iteration.
71 sequence = a possible empty array
73 returns = 1 if the sequence is an empty Boost PP array
76 The macro will generate a preprocessing error if the sequence
77 is in the form of an array but its first tuple element, instead
78 of being a number, is a preprocessor token which VMD cannot parse,
79 as in the example '(&0,())' which is a valid tuple but an invalid
84 #define BOOST_VMD_IS_EMPTY_ARRAY_D(d,sequence) \
85 BOOST_VMD_IDENTITY_RESULT \
89 BOOST_VMD_IS_ARRAY_D(d,sequence), \
90 BOOST_VMD_DETAIL_IS_EMPTY_ARRAY_SIZE, \
91 BOOST_VMD_IDENTITY(0) \
97 #endif /* BOOST_PP_VARIADICS */
98 #endif /* BOOST_VMD_IS_EMPTY_ARRAY_HPP */