#ifndef BOOST_SCOPE_ERROR_CODE_CHECKER_HPP_INCLUDED_
#define BOOST_SCOPE_ERROR_CODE_CHECKER_HPP_INCLUDED_
#include <boost/core/addressof.hpp>
#include <boost/scope/detail/config.hpp>
#include <boost/scope/detail/header.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost {
namespace scope {
template< typename ErrorCode >
class error_code_checker
{
public:
using result_type = bool;
private:
ErrorCode* m_error_code;
public:
explicit error_code_checker(ErrorCode& ec) noexcept :
m_error_code(boost::addressof(ec))
{
}
result_type operator()() const noexcept
{
return !!(*m_error_code);
}
};
template< typename ErrorCode >
inline error_code_checker< ErrorCode > check_error_code(ErrorCode& ec) noexcept
{
return error_code_checker< ErrorCode >(ec);
}
} }
#include <boost/scope/detail/footer.hpp>
#endif