#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