]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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_ARRAY_HPP) | |
8 | #define BOOST_VMD_IS_EMPTY_ARRAY_HPP | |
9 | ||
10 | #include <boost/vmd/detail/setup.hpp> | |
11 | ||
12 | #if BOOST_PP_VARIADICS | |
13 | ||
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> | |
18 | ||
19 | /* | |
20 | ||
21 | The succeeding comments in this file are in doxygen format. | |
22 | ||
23 | */ | |
24 | ||
25 | /** \file | |
26 | */ | |
27 | ||
28 | /** \def BOOST_VMD_IS_EMPTY_ARRAY(sequence) | |
29 | ||
30 | \brief Tests whether a sequence is an empty Boost PP array. | |
31 | ||
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,())'. | |
35 | ||
36 | sequence = a possible empty array | |
37 | ||
38 | returns = 1 if the sequence is an empty Boost PP array | |
39 | 0 if it is not. | |
40 | ||
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 | |
45 | array. | |
46 | ||
47 | */ | |
48 | ||
49 | #define BOOST_VMD_IS_EMPTY_ARRAY(sequence) \ | |
50 | BOOST_VMD_IDENTITY_RESULT \ | |
51 | ( \ | |
52 | BOOST_PP_IIF \ | |
53 | ( \ | |
54 | BOOST_VMD_IS_ARRAY(sequence), \ | |
55 | BOOST_VMD_DETAIL_IS_EMPTY_ARRAY_SIZE, \ | |
56 | BOOST_VMD_IDENTITY(0) \ | |
57 | ) \ | |
58 | (sequence) \ | |
59 | ) \ | |
60 | /**/ | |
61 | ||
62 | /** \def BOOST_VMD_IS_EMPTY_ARRAY_D(d,sequence) | |
63 | ||
64 | \brief Tests whether a sequence is an empty Boost PP array. Re-entrant version. | |
65 | ||
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,())'. | |
69 | ||
70 | d = The next available BOOST_PP_WHILE iteration. | |
71 | sequence = a possible empty array | |
72 | ||
73 | returns = 1 if the sequence is an empty Boost PP array | |
74 | 0 if it is not. | |
75 | ||
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 | |
80 | array. | |
81 | ||
82 | */ | |
83 | ||
84 | #define BOOST_VMD_IS_EMPTY_ARRAY_D(d,sequence) \ | |
85 | BOOST_VMD_IDENTITY_RESULT \ | |
86 | ( \ | |
87 | BOOST_PP_IIF \ | |
88 | ( \ | |
89 | BOOST_VMD_IS_ARRAY_D(d,sequence), \ | |
90 | BOOST_VMD_DETAIL_IS_EMPTY_ARRAY_SIZE, \ | |
91 | BOOST_VMD_IDENTITY(0) \ | |
92 | ) \ | |
93 | (sequence) \ | |
94 | ) \ | |
95 | /**/ | |
96 | ||
97 | #endif /* BOOST_PP_VARIADICS */ | |
98 | #endif /* BOOST_VMD_IS_EMPTY_ARRAY_HPP */ |