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.
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.
44 returns = Normally the macro returns nothing.
46 If the sequence is an identifier, nothing is
47 output. If optional ids are specified, for the
48 sequence to be an identifier it must be an
49 identifier that matches one of the optional
52 For VC++, because there is no sure way of forcing
53 a compiler error from within a macro without producing
54 output, if the sequence is not an identifier the
55 macro forces a compiler error by outputting invalid C++.
57 For all other compilers a compiler error is forced
58 without producing output if the sequence is not an
61 Identifiers are registered in VMD with:
63 #define BOOST_VMD_REG_XXX (XXX) where XXX is a v-identifier.
65 The identifier must be registered to be found.
67 Identifiers are pre-detected in VMD with:
69 #define BOOST_VMD_DETECT_XXX_XXX where XXX is an identifier.
71 If you specify optional ids and have not specified the detection
72 of an optional id, that id will never match an identifier.
76 /** \def BOOST_VMD_ASSERT_IS_IDENTIFIER_D(d,...)
78 \brief Asserts that the sequence is an identifier. Re-entrant version.
80 The macro checks that the sequence is an identifier.
81 If it is not an identifier, it forces a compiler error.
83 The macro normally checks for an identifier only in
84 debug mode. However an end-user can force the macro
85 to check or not check by defining the macro
86 BOOST_VMD_ASSERT_DATA to 1 or 0 respectively.
88 d = The next available BOOST_PP_WHILE iteration.
89 ... = variadic parameters
91 The variadic parameters are:
93 sequence = A sequence to test as an identifier.
94 ids (optional) = The data may take one of two forms:
95 it is either one or more single identifiers
96 or a single Boost PP tuple of identifiers.
98 returns = Normally the macro returns nothing.
100 If the sequence is an identifier, nothing is
101 output. If optional ids are specified, for the
102 sequence to be an identifier it must be an
103 identifier that matches one of the optional
106 For VC++, because there is no sure way of forcing
107 a compiler error from within a macro without producing
108 output, if the sequence is not an identifier the
109 macro forces a compiler error by outputting invalid C++.
111 For all other compilers a compiler error is forced
112 without producing output if the sequence is not an
115 Identifiers are registered in VMD with:
117 #define BOOST_VMD_REG_XXX (XXX) where XXX is a v-identifier.
119 The identifier must be registered to be found.
121 Identifiers are pre-detected in VMD with:
123 #define BOOST_VMD_DETECT_XXX_XXX where XXX is an identifier.
125 If you specify optional ids and have not specified the detection
126 of an optional id, that id will never match an identifier.
130 #if !BOOST_VMD_ASSERT_DATA
132 #define BOOST_VMD_ASSERT_IS_IDENTIFIER(...)
133 #define BOOST_VMD_ASSERT_IS_IDENTIFIER_D(d,...)
137 #include <boost/vmd/assert.hpp>
138 #include <boost/vmd/is_identifier.hpp>
140 #define BOOST_VMD_ASSERT_IS_IDENTIFIER(...) \
143 BOOST_VMD_IS_IDENTIFIER(__VA_ARGS__), \
144 BOOST_VMD_IDENTIFIER_ASSERT_ERROR \
148 #define BOOST_VMD_ASSERT_IS_IDENTIFIER_D(d,...) \
151 BOOST_VMD_IS_IDENTIFIER_D(d,__VA_ARGS__), \
152 BOOST_VMD_IDENTIFIER_ASSERT_ERROR \
156 #endif // !BOOST_VMD_ASSERT_DATA
157 #endif /* BOOST_PP_VARIADICS */
158 #endif /* BOOST_VMD_ASSERT_IS_IDENTIFIER_HPP */