123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- #ifndef BOOST_SCOPE_EXCEPTION_CHECKER_HPP_INCLUDED_
- #define BOOST_SCOPE_EXCEPTION_CHECKER_HPP_INCLUDED_
- #include <boost/assert.hpp>
- #include <boost/scope/detail/config.hpp>
- #include <boost/core/uncaught_exceptions.hpp>
- #include <boost/scope/detail/header.hpp>
- #ifdef BOOST_HAS_PRAGMA_ONCE
- #pragma once
- #endif
- namespace boost {
- namespace scope {
- class exception_checker
- {
- public:
-
- using result_type = bool;
- private:
- unsigned int m_uncaught_count;
- public:
-
- exception_checker() noexcept :
- m_uncaught_count(boost::core::uncaught_exceptions())
- {
- }
-
- result_type operator()() const noexcept
- {
- const unsigned int uncaught_count = boost::core::uncaught_exceptions();
-
-
-
- BOOST_ASSERT((uncaught_count - m_uncaught_count) <= 1u);
- return uncaught_count > m_uncaught_count;
- }
- };
- inline exception_checker check_exception() noexcept
- {
- return exception_checker();
- }
- }
- }
- #include <boost/scope/detail/footer.hpp>
- #endif
|