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 @code 48 49 returns = Normally the macro returns nothing. 50 51 If the input is empty, nothing is output. 52 53 For VC++, because there is no sure way of forcing 54 a compiler error from within a macro without producing 55 output, if the input is not empty the 56 macro forces a compiler error by outputting invalid C++. 57 58 For all other compilers a compiler error is forced 59 without producing output if the input is not empty. 60 61 @endcode 62 63 It is recommended to append BOOST_PP_EMPTY() to whatever input 64 is being tested in order to avoid possible warning messages 65 from some compilers about no parameters being passed to the macro 66 when the input is truly empty. 67 68 */ 69 70 #if BOOST_VMD_MSVC_V8 71 72 #if !BOOST_VMD_ASSERT_DATA 73 74 #define BOOST_VMD_ASSERT_IS_EMPTY(input) 75 76 #else 77 78 #define BOOST_VMD_ASSERT_IS_EMPTY(input) \ 79 BOOST_VMD_ASSERT \ 80 ( \ 81 BOOST_VMD_IS_EMPTY(input), \ 82 BOOST_VMD_IS_EMPTY_ASSERT_ERROR \ 83 ) \ 84 /**/ 85 86 #endif // !BOOST_VMD_ASSERT_DATA 87 88 #else 89 90 #if !BOOST_VMD_ASSERT_DATA 91 92 #define BOOST_VMD_ASSERT_IS_EMPTY(...) 93 94 #else 95 96 #define BOOST_VMD_ASSERT_IS_EMPTY(...) \ 97 BOOST_VMD_ASSERT \ 98 ( \ 99 BOOST_VMD_IS_EMPTY(__VA_ARGS__), \ 100 BOOST_VMD_IS_EMPTY_ASSERT_ERROR \ 101 ) \ 102 /**/ 103 104 #endif // !BOOST_VMD_ASSERT_DATA 105 106 #endif /* BOOST_VMD_MSVC_V8 */ 107 108 #endif /* BOOST_PP_VARIADICS */ 109 #endif /* BOOST_VMD_ASSERT_IS_EMPTY_HPP */ 110