]>
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_ASSERT_IS_TYPE_HPP) | |
8 | #define BOOST_VMD_ASSERT_IS_TYPE_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_TYPE(sequence) | |
24 | ||
25 | \brief Asserts that the sequence is a VMD type. | |
26 | ||
27 | The macro checks that the sequence is a VMD type. | |
28 | If it is not a VMD type, it forces a compiler error. | |
29 | ||
30 | The macro normally checks for a VMD type 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 VMD type. | |
36 | ||
f67539c2 TL |
37 | @code |
38 | ||
7c673cae FG |
39 | returns = Normally the macro returns nothing. |
40 | ||
41 | If the sequence is a VMD type, 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 VMD type 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 | VMD type. | |
52 | ||
f67539c2 TL |
53 | @endcode |
54 | ||
7c673cae FG |
55 | */ |
56 | ||
57 | /** \def BOOST_VMD_ASSERT_IS_TYPE_D(d,sequence) | |
58 | ||
59 | \brief Asserts that the sequence is a VMD type. Re-entrant version. | |
60 | ||
61 | The macro checks that the sequence is a VMD type. | |
62 | If it is not a VMD type, it forces a compiler error. | |
63 | ||
64 | The macro normally checks for a VMD type 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 | ||
f67539c2 | 69 | d = The next available BOOST_PP_WHILE iteration. <br/> |
7c673cae FG |
70 | sequence = a possible VMD type. |
71 | ||
f67539c2 TL |
72 | @code |
73 | ||
7c673cae FG |
74 | returns = Normally the macro returns nothing. |
75 | ||
76 | If the sequence is a VMD type, 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 VMD type 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 | VMD type. | |
87 | ||
f67539c2 TL |
88 | @endcode |
89 | ||
7c673cae FG |
90 | */ |
91 | ||
92 | #if !BOOST_VMD_ASSERT_DATA | |
93 | ||
94 | #define BOOST_VMD_ASSERT_IS_TYPE(sequence) | |
95 | #define BOOST_VMD_ASSERT_IS_TYPE_D(d,sequence) | |
96 | ||
97 | #else | |
98 | ||
99 | #include <boost/vmd/assert.hpp> | |
100 | #include <boost/vmd/is_type.hpp> | |
101 | ||
102 | #define BOOST_VMD_ASSERT_IS_TYPE(sequence) \ | |
103 | BOOST_VMD_ASSERT \ | |
104 | ( \ | |
105 | BOOST_VMD_IS_TYPE(sequence), \ | |
106 | BOOST_VMD_IS_TYPE_ASSERT_ERROR \ | |
107 | ) \ | |
108 | /**/ | |
109 | ||
110 | #define BOOST_VMD_ASSERT_IS_TYPE_D(d,sequence) \ | |
111 | BOOST_VMD_ASSERT \ | |
112 | ( \ | |
113 | BOOST_VMD_IS_TYPE_D(d,sequence), \ | |
114 | BOOST_VMD_IS_TYPE_ASSERT_ERROR \ | |
115 | ) \ | |
116 | /**/ | |
117 | ||
118 | #endif // !BOOST_VMD_ASSERT_DATA | |
119 | ||
120 | #endif /* BOOST_PP_VARIADICS */ | |
121 | #endif /* BOOST_VMD_ASSERT_IS_TYPE_HPP */ |