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_NUMBER_HPP) 8 #define BOOST_VMD_ASSERT_IS_NUMBER_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_NUMBER(sequence) 24 25 \brief Asserts that the sequence is a number. 26 27 The macro checks that the parameter is a number. 28 If it is not a number, it forces a compiler error. 29 30 The macro normally checks for a number 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 number. 36 37 @code 38 39 returns = Normally the macro returns nothing. 40 41 If the sequence is a number, 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 number 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 number. 52 53 @endcode 54 55 */ 56 57 #if !BOOST_VMD_ASSERT_DATA 58 59 #define BOOST_VMD_ASSERT_IS_NUMBER(sequence) 60 61 #else 62 63 #include <boost/vmd/assert.hpp> 64 #include <boost/vmd/is_number.hpp> 65 66 #define BOOST_VMD_ASSERT_IS_NUMBER(sequence) \ 67 BOOST_VMD_ASSERT \ 68 ( \ 69 BOOST_VMD_IS_NUMBER(sequence), \ 70 BOOST_VMD_IS_NUMBER_ASSERT_ERROR \ 71 ) \ 72 /**/ 73 74 #endif // !BOOST_VMD_ASSERT_DATA 75 76 #endif /* BOOST_PP_VARIADICS */ 77 #endif /* BOOST_VMD_ASSERT_IS_NUMBER_HPP */ 78