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_ASSERT_IS_IDENTIFIER_HPP)
8 #define BOOST_VMD_ASSERT_IS_IDENTIFIER_HPP
10 #include <boost/vmd/detail/setup.hpp>
12 #if BOOST_PP_VARIADICS
16 The succeeding comments in this file are in doxygen format.
23 /** \def BOOST_VMD_ASSERT_IS_IDENTIFIER(...)
25 \brief Asserts that the sequence is an identifier.
27 The macro checks that the sequence is an identifier.
28 If it is not an identifier, it forces a compiler error.
30 The macro normally checks for an identifier 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.
35 ... = variadic parameters
37 The variadic parameters are:
39 sequence = A sequence to test as an identifier. <br/>
40 ids (optional) = The data may take one of two forms:
41 it is either one or more single identifiers
42 or a single Boost PP tuple of identifiers.
46 returns = Normally the macro returns nothing.
48 If the sequence is an identifier, nothing is
49 output. If optional ids are specified, for the
50 sequence to be an identifier it must be an
51 identifier that matches one of the optional
54 For VC++, because there is no sure way of forcing
55 a compiler error from within a macro without producing
56 output, if the sequence is not an identifier the
57 macro forces a compiler error by outputting invalid C++.
59 For all other compilers a compiler error is forced
60 without producing output if the sequence is not an
65 Identifiers are registered in VMD with:
69 #define BOOST_VMD_REG_XXX (XXX) where XXX is a v-identifier.
73 The identifier must be registered to be found.
75 Identifiers are pre-detected in VMD with:
79 #define BOOST_VMD_DETECT_XXX_XXX where XXX is an identifier.
83 If you specify optional ids and have not specified the detection
84 of an optional id, that id will never match an identifier.
88 /** \def BOOST_VMD_ASSERT_IS_IDENTIFIER_D(d,...)
90 \brief Asserts that the sequence is an identifier. Re-entrant version.
92 The macro checks that the sequence is an identifier.
93 If it is not an identifier, it forces a compiler error.
95 The macro normally checks for an identifier only in
96 debug mode. However an end-user can force the macro
97 to check or not check by defining the macro
98 BOOST_VMD_ASSERT_DATA to 1 or 0 respectively.
100 d = The next available BOOST_PP_WHILE iteration. <br/>
101 ... = variadic parameters
103 The variadic parameters are:
105 sequence = A sequence to test as an identifier. <br/>
106 ids (optional) = The data may take one of two forms:
107 it is either one or more single identifiers
108 or a single Boost PP tuple of identifiers.
112 returns = Normally the macro returns nothing.
114 If the sequence is an identifier, nothing is
115 output. If optional ids are specified, for the
116 sequence to be an identifier it must be an
117 identifier that matches one of the optional
120 For VC++, because there is no sure way of forcing
121 a compiler error from within a macro without producing
122 output, if the sequence is not an identifier the
123 macro forces a compiler error by outputting invalid C++.
125 For all other compilers a compiler error is forced
126 without producing output if the sequence is not an
131 Identifiers are registered in VMD with:
135 #define BOOST_VMD_REG_XXX (XXX) where XXX is a v-identifier.
139 The identifier must be registered to be found.
141 Identifiers are pre-detected in VMD with:
145 #define BOOST_VMD_DETECT_XXX_XXX where XXX is an identifier.
149 If you specify optional ids and have not specified the detection
150 of an optional id, that id will never match an identifier.
154 #if !BOOST_VMD_ASSERT_DATA
156 #define BOOST_VMD_ASSERT_IS_IDENTIFIER(...)
157 #define BOOST_VMD_ASSERT_IS_IDENTIFIER_D(d,...)
161 #include <boost/vmd/assert.hpp>
162 #include <boost/vmd/is_identifier.hpp>
164 #define BOOST_VMD_ASSERT_IS_IDENTIFIER(...) \
167 BOOST_VMD_IS_IDENTIFIER(__VA_ARGS__), \
168 BOOST_VMD_IDENTIFIER_ASSERT_ERROR \
172 #define BOOST_VMD_ASSERT_IS_IDENTIFIER_D(d,...) \
175 BOOST_VMD_IS_IDENTIFIER_D(d,__VA_ARGS__), \
176 BOOST_VMD_IDENTIFIER_ASSERT_ERROR \
180 #endif // !BOOST_VMD_ASSERT_DATA
181 #endif /* BOOST_PP_VARIADICS */
182 #endif /* BOOST_VMD_ASSERT_IS_IDENTIFIER_HPP */