error_code.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef BOOST_SYSTEM_ERROR_CODE_HPP_INCLUDED
  2. #define BOOST_SYSTEM_ERROR_CODE_HPP_INCLUDED
  3. // Copyright Beman Dawes 2006, 2007
  4. // Copyright Christoper Kohlhoff 2007
  5. // Copyright Peter Dimov 2017, 2018
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. // See library home page at http://www.boost.org/libs/system
  11. #include <boost/system/detail/error_code.hpp>
  12. #include <boost/system/error_category.hpp>
  13. #include <boost/system/error_condition.hpp>
  14. #include <boost/system/errc.hpp>
  15. #include <boost/system/generic_category.hpp>
  16. #include <boost/system/system_category.hpp>
  17. #include <boost/system/detail/throws.hpp>
  18. #include <boost/config.hpp>
  19. namespace boost
  20. {
  21. namespace system
  22. {
  23. // non-member functions of error_code and error_condition
  24. inline bool operator==( const error_code & code, const error_condition & condition ) BOOST_NOEXCEPT
  25. {
  26. return code.category().equivalent( code.value(), condition ) || condition.category().equivalent( code, condition.value() );
  27. }
  28. inline bool operator!=( const error_code & lhs, const error_condition & rhs ) BOOST_NOEXCEPT
  29. {
  30. return !( lhs == rhs );
  31. }
  32. inline bool operator==( const error_condition & condition, const error_code & code ) BOOST_NOEXCEPT
  33. {
  34. return code.category().equivalent( code.value(), condition ) || condition.category().equivalent( code, condition.value() );
  35. }
  36. inline bool operator!=( const error_condition & lhs, const error_code & rhs ) BOOST_NOEXCEPT
  37. {
  38. return !( lhs == rhs );
  39. }
  40. } // namespace system
  41. } // namespace boost
  42. #endif // BOOST_SYSTEM_ERROR_CODE_HPP_INCLUDED