• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_ARRAY_HPP)
8 #define BOOST_VMD_ASSERT_IS_ARRAY_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_ARRAY(sequence)
24 
25     \brief Asserts that the sequence is a Boost PP array.
26 
27     The macro checks that the sequence is a Boost PP array.
28     If it is not a Boost PP array, it forces a compiler error.
29 
30     The macro normally checks for a Boost PP array 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  array.
36 
37   @code
38 
39     returns  = Normally the macro returns nothing.
40 
41                If the sequence is a Boost PP array, nothing is
42                output.
43 
44                For VC++, because there is no sure way of forcing
45                a compiler error from within a macro without producing
46                output, if the sequence is not a Boost PP array the
47                macro forces a compiler error by outputting invalid C++.
48 
49                For all other compilers a compiler error is forced
50                without producing output if the sequence is not a
51                Boost PP array.
52 
53   @endcode
54 
55 */
56 
57 /** \def BOOST_VMD_ASSERT_IS_ARRAY_D(d,sequence)
58 
59     \brief Asserts that the sequence is a Boost PP array. Re-entrant version.
60 
61     The macro checks that the sequence is a Boost PP array.
62     If it is not a Boost PP array, it forces a compiler error.
63 
64     The macro normally checks for a Boost PP array only in
65     debug mode. However an end-user can force the macro
66     to check or not check by defining the macro
67     BOOST_VMD_ASSERT_DATA to 1 or 0 respectively.
68 
69     d        = The next available BOOST_PP_WHILE iteration. <br/>
70     sequence = a possible Boost PP sequence.
71 
72   @code
73 
74     returns  = Normally the macro returns nothing.
75 
76                If the sequence is a Boost PP array, nothing is
77                output.
78 
79                For VC++, because there is no sure way of forcing
80                a compiler error from within a macro without producing
81                output, if the sequence is not a Boost PP array the
82                macro forces a compiler error by outputting invalid C++.
83 
84                For all other compilers a compiler error is forced
85                without producing output if the sequence is not a
86                Boost PP array.
87 
88   @endcode
89 
90 */
91 
92 #if !BOOST_VMD_ASSERT_DATA
93 
94 #define BOOST_VMD_ASSERT_IS_ARRAY(sequence)
95 #define BOOST_VMD_ASSERT_IS_ARRAY_D(d,sequence)
96 
97 #else
98 
99 #include <boost/vmd/is_array.hpp>
100 #include <boost/vmd/assert.hpp>
101 
102 #define BOOST_VMD_ASSERT_IS_ARRAY(sequence) \
103     BOOST_VMD_ASSERT \
104           ( \
105           BOOST_VMD_IS_ARRAY(sequence), \
106           BOOST_VMD_IS_ARRAY_ASSERT_ERROR \
107           ) \
108 /**/
109 
110 #define BOOST_VMD_ASSERT_IS_ARRAY_D(d,sequence) \
111     BOOST_VMD_ASSERT \
112           ( \
113           BOOST_VMD_IS_ARRAY_D(d,sequence), \
114           BOOST_VMD_IS_ARRAY_ASSERT_ERROR \
115           ) \
116 /**/
117 
118 #endif /* !BOOST_VMD_ASSERT_DATA */
119 
120 #endif /* BOOST_PP_VARIADICS */
121 #endif /* BOOST_VMD_ASSERT_IS_ARRAY_HPP */
122