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_ASSERT_IS_SEQ_HPP) |
8 | #define BOOST_VMD_ASSERT_IS_SEQ_HPP |
9 | |
10 | #include <boost/vmd/detail/setup.hpp> |
11 | |
12 | #if BOOST_PP_VARIADICS |
13 | |
14 | /* |
15 | |
16 | The succeeding comments in this file are in doxygen format. |
17 | |
18 | */ |
19 | |
20 | /** \file |
21 | */ |
22 | |
23 | /** \def BOOST_VMD_ASSERT_IS_SEQ(sequence) |
24 | |
25 | \brief Asserts that the sequence is a Boost PP seq. |
26 | |
27 | The macro checks that the sequence is a Boost PP seq. |
28 | If it is not a Boost PP seq, it forces a compiler error. |
29 | |
30 | The macro normally checks for a Boost PP seq only in |
31 | debug mode. However an end-user can force the macro |
32 | to check or not check by defining the macro |
33 | BOOST_VMD_ASSERT_DATA to 1 or 0 respectively. |
34 | |
35 | sequence = a possible Boost PP seq. |
36 | |
37 | returns = Normally the macro returns nothing. |
38 | |
39 | If the sequence is a Boost PP seq, nothing is |
40 | output. |
41 | |
42 | For VC++, because there is no sure way of forcing |
43 | a compiler error from within a macro without producing |
44 | output, if the sequence is not a Boost PP seq the |
45 | macro forces a compiler error by outputting invalid C++. |
46 | |
47 | For all other compilers a compiler error is forced |
48 | without producing output if the sequence is not a |
49 | Boost PP seq. |
50 | |
51 | */ |
52 | |
53 | /** \def BOOST_VMD_ASSERT_IS_SEQ_D(d,sequence) |
54 | |
55 | \brief Asserts that the sequence is a Boost PP seq. Re-entrant version. |
56 | |
57 | The macro checks that the sequence is a Boost PP seq. |
58 | If it is not a Boost PP seq, it forces a compiler error. |
59 | |
60 | The macro normally checks for a Boost PP seq only in |
61 | debug mode. However an end-user can force the macro |
62 | to check or not check by defining the macro |
63 | BOOST_VMD_ASSERT_DATA to 1 or 0 respectively. |
64 | |
65 | d = The next available BOOST_PP_WHILE iteration. |
66 | sequence = a possible Boost PP seq. |
67 | |
68 | returns = Normally the macro returns nothing. |
69 | |
70 | If the sequence is a Boost PP seq, nothing is |
71 | output. |
72 | |
73 | For VC++, because there is no sure way of forcing |
74 | a compiler error from within a macro without producing |
75 | output, if the sequence is not a Boost PP seq the |
76 | macro forces a compiler error by outputting invalid C++. |
77 | |
78 | For all other compilers a compiler error is forced |
79 | without producing output if the sequence is not a |
80 | Boost PP seq. |
81 | |
82 | */ |
83 | |
84 | #if !BOOST_VMD_ASSERT_DATA |
85 | |
86 | #define BOOST_VMD_ASSERT_IS_SEQ(sequence) |
87 | #define BOOST_VMD_ASSERT_IS_SEQ_D(d,sequence) |
88 | |
89 | #else |
90 | |
91 | #include <boost/vmd/assert.hpp> |
92 | #include <boost/vmd/is_seq.hpp> |
93 | |
94 | #define BOOST_VMD_ASSERT_IS_SEQ(sequence) \ |
95 | BOOST_VMD_ASSERT \ |
96 | ( \ |
97 | BOOST_VMD_IS_SEQ(sequence), \ |
98 | BOOST_VMD_ASSERT_IS_SEQ_ERROR \ |
99 | ) \ |
100 | /**/ |
101 | |
102 | #define BOOST_VMD_ASSERT_IS_SEQ_D(d,sequence) \ |
103 | BOOST_VMD_ASSERT \ |
104 | ( \ |
105 | BOOST_VMD_IS_SEQ_D(d,sequence), \ |
106 | BOOST_VMD_ASSERT_IS_SEQ_ERROR \ |
107 | ) \ |
108 | /**/ |
109 | |
110 | #endif /* BOOST_VMD_ASSERT_DATA */ |
111 | |
112 | #endif /* BOOST_PP_VARIADICS */ |
113 | #endif /* BOOST_VMD_ASSERT_IS_SEQ_HPP */ |
114 | |