123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- #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
|