diff --git a/include/boost/compat/detail/throw_system_error.hpp b/include/boost/compat/detail/throw_system_error.hpp new file mode 100644 index 0000000..2f363e5 --- /dev/null +++ b/include/boost/compat/detail/throw_system_error.hpp @@ -0,0 +1,25 @@ +#ifndef BOOST_COMPAT_DETAIL_THROW_SYSTEM_ERROR_HPP_INCLUDED +#define BOOST_COMPAT_DETAIL_THROW_SYSTEM_ERROR_HPP_INCLUDED + +// Copyright 2023 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include +#include +#include + +namespace boost { +namespace compat { +namespace detail { + +BOOST_NORETURN BOOST_NOINLINE inline void throw_system_error( std::errc e, boost::source_location const& loc = BOOST_CURRENT_LOCATION ) +{ + boost::throw_exception( std::system_error( std::make_error_code( e ) ), loc ); +} + +} // namespace detail +} // namespace compat +} // namespace boost + +#endif // BOOST_COMPAT_DETAIL_THROW_SYSTEM_ERROR_HPP_INCLUDED diff --git a/include/boost/compat/shared_lock.hpp b/include/boost/compat/shared_lock.hpp index 91edaa8..cf6ed72 100644 --- a/include/boost/compat/shared_lock.hpp +++ b/include/boost/compat/shared_lock.hpp @@ -5,12 +5,11 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include -#include +#include -#include -#include -#include +#include // std::addressof +#include // std::defer_lock_t +#include // std::errc namespace boost { namespace compat { @@ -21,14 +20,6 @@ class shared_lock; template void swap( shared_lock& x, shared_lock& y ) noexcept; -namespace detail { - -BOOST_NORETURN BOOST_NOINLINE inline void -throw_system_error( std::errc e, boost::source_location const& loc = BOOST_CURRENT_LOCATION ) { - boost::throw_exception( std::system_error( std::make_error_code( e ) ), loc ); -} -} // namespace detail - template class shared_lock { private: