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_EXCEPTION_HPP_
0003 #define BOOST_CONTRACT_DETAIL_EXCEPTION_HPP_
0004 
0005 // Copyright (C) 2008-2019 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/config.hpp>
0011 #include <exception>
0012 
0013 namespace boost { namespace contract { namespace detail {
0014 
0015 // Using this instead of std::uncaught_exception() because
0016 // std::uncaught_exception will be removed in C++20.
0017 inline bool uncaught_exception() BOOST_NOEXCEPT {
0018     // Alternatively, this could just return `boost::core::uncaught_exceptions()
0019     // > 0` but that emulates the exception count which is not needed by this
0020     // lib (the implementation below is simpler and could be faster).
0021     #ifdef __cpp_lib_uncaught_exceptions
0022         return std::uncaught_exceptions() > 0;
0023     #else
0024         return std::uncaught_exception();
0025     #endif
0026 }
0027 
0028 } } } // namespace
0029 
0030 #endif // #include guard
0031