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_EMPTY_HPP)
8#define BOOST_VMD_ASSERT_IS_EMPTY_HPP
9
10#include <boost/vmd/detail/setup.hpp>
11
12#if BOOST_PP_VARIADICS
13
14#if BOOST_VMD_ASSERT_DATA
15
16#include <boost/vmd/assert.hpp>
17#include <boost/vmd/is_empty.hpp>
18
19#endif
20
21/*
22
23 The succeeding comments in this file are in doxygen format.
24
25*/
26
27/** \file
28*/
29
30/** \def BOOST_VMD_ASSERT_IS_EMPTY(...)
31
32 \brief Asserts that the input is empty.
33
34 The macro checks to see if the input is empty or not.
35 If it is not empty, it forces a compiler error.
36
37 The macro is a variadic macro taking any input.
38 For the VC++8 compiler (VS2005) the macro takes a single parameter of input to check and not variadic data.
39
40 The macro normally checks for emptiness only in
41 debug mode. However an end-user can force the macro
42 to check or not check by defining the macro
43 BOOST_VMD_ASSERT_DATA to 1 or 0 respectively.
44
45 .... = variadic input, for VC++8 this must be a single parameter.
46
47 returns = Normally the macro returns nothing.
48
49 If the input is empty, nothing is output.
50
51 For VC++, because there is no sure way of forcing
52 a compiler error from within a macro without producing
53 output, if the input is not empty the
54 macro forces a compiler error by outputting invalid C++.
55
56 For all other compilers a compiler error is forced
57 without producing output if the input is not empty.
58
59 It is recommended to append BOOST_PP_EMPTY() to whatever input
60 is being tested in order to avoid possible warning messages
61 from some compilers about no parameters being passed to the macro
62 when the input is truly empty.
63
64*/
65
66#if BOOST_VMD_MSVC_V8
67
68#if !BOOST_VMD_ASSERT_DATA
69
70#define BOOST_VMD_ASSERT_IS_EMPTY(input)
71
72#else
73
74#define BOOST_VMD_ASSERT_IS_EMPTY(input) \
75 BOOST_VMD_ASSERT \
76 ( \
77 BOOST_VMD_IS_EMPTY(input), \
78 BOOST_VMD_IS_EMPTY_ASSERT_ERROR \
79 ) \
80/**/
81
82#endif // !BOOST_VMD_ASSERT_DATA
83
84#else
85
86#if !BOOST_VMD_ASSERT_DATA
87
88#define BOOST_VMD_ASSERT_IS_EMPTY(...)
89
90#else
91
92#define BOOST_VMD_ASSERT_IS_EMPTY(...) \
93 BOOST_VMD_ASSERT \
94 ( \
95 BOOST_VMD_IS_EMPTY(__VA_ARGS__), \
96 BOOST_VMD_IS_EMPTY_ASSERT_ERROR \
97 ) \
98/**/
99
100#endif // !BOOST_VMD_ASSERT_DATA
101
102#endif /* BOOST_VMD_MSVC_V8 */
103
104#endif /* BOOST_PP_VARIADICS */
105#endif /* BOOST_VMD_ASSERT_IS_EMPTY_HPP */
106

source code of boost/boost/vmd/assert_is_empty.hpp