Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:26

0001 
0002 #ifndef BOOST_CONTRACT_DETAIL_ASSERT_HPP_
0003 #define BOOST_CONTRACT_DETAIL_ASSERT_HPP_
0004 
0005 // Copyright (C) 2008-2018 Lorenzo Caminiti
0006 // Distributed under the Boost Software License, Version 1.0 (see accompanying
0007 // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
0008 // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html
0009 
0010 #include <boost/contract/core/exception.hpp>
0011 #include <boost/contract/detail/noop.hpp>
0012 #include <boost/preprocessor/stringize.hpp>
0013 
0014 // In detail because used by both ASSERT and CHECK.
0015 // Use ternary operator `?:` and no trailing `;` here to allow `if(...) ASSERT(
0016 // ...); else ...` (won't compile if expands using an if statement instead even
0017 // if wrapped by {}, and else won't compile if expands trailing `;`).
0018 #define BOOST_CONTRACT_DETAIL_ASSERT(cond) \
0019     /* no if-statement here */ \
0020     ((cond) ? \
0021         BOOST_CONTRACT_DETAIL_NOOP \
0022     : \
0023         throw boost::contract::assertion_failure( \
0024                 __FILE__, __LINE__, BOOST_PP_STRINGIZE(cond)) \
0025     ) /* no ; here */
0026 
0027 #endif // #include guard
0028