throw_system_error.hpp 754 B

12345678910111213141516171819202122232425
  1. #ifndef BOOST_COMPAT_DETAIL_THROW_SYSTEM_ERROR_HPP_INCLUDED
  2. #define BOOST_COMPAT_DETAIL_THROW_SYSTEM_ERROR_HPP_INCLUDED
  3. // Copyright 2023 Peter Dimov
  4. // Distributed under the Boost Software License, Version 1.0.
  5. // https://www.boost.org/LICENSE_1_0.txt
  6. #include <boost/throw_exception.hpp>
  7. #include <boost/config.hpp>
  8. #include <system_error>
  9. namespace boost {
  10. namespace compat {
  11. namespace detail {
  12. BOOST_NORETURN BOOST_NOINLINE inline void throw_system_error( std::errc e, boost::source_location const& loc = BOOST_CURRENT_LOCATION )
  13. {
  14. boost::throw_exception( std::system_error( std::make_error_code( e ) ), loc );
  15. }
  16. } // namespace detail
  17. } // namespace compat
  18. } // namespace boost
  19. #endif // BOOST_COMPAT_DETAIL_THROW_SYSTEM_ERROR_HPP_INCLUDED