unique_resource_fwd.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Distributed under the Boost Software License, Version 1.0.
  3. * (See accompanying file LICENSE_1_0.txt or copy at
  4. * https://www.boost.org/LICENSE_1_0.txt)
  5. *
  6. * Copyright (c) 2022 Andrey Semashev
  7. */
  8. /*!
  9. * \file scope/unique_resource_fwd.hpp
  10. *
  11. * This header contains forward declaration of \c unique_resource template.
  12. */
  13. #ifndef BOOST_SCOPE_UNIQUE_RESOURCE_FWD_HPP_INCLUDED_
  14. #define BOOST_SCOPE_UNIQUE_RESOURCE_FWD_HPP_INCLUDED_
  15. #include <type_traits>
  16. #include <boost/scope/detail/config.hpp>
  17. #include <boost/scope/detail/move_or_copy_construct_ref.hpp>
  18. #include <boost/scope/detail/type_traits/conjunction.hpp>
  19. #include <boost/scope/detail/header.hpp>
  20. #ifdef BOOST_HAS_PRAGMA_ONCE
  21. #pragma once
  22. #endif
  23. namespace boost {
  24. namespace scope {
  25. template< typename Resource, typename Deleter, typename Traits = void >
  26. class unique_resource;
  27. template< typename Resource, typename Deleter, typename Invalid = typename std::decay< Resource >::type >
  28. unique_resource< typename std::decay< Resource >::type, typename std::decay< Deleter >::type >
  29. make_unique_resource_checked(Resource&& res, Invalid const& invalid, Deleter&& del)
  30. noexcept(BOOST_SCOPE_DETAIL_DOC_HIDDEN(detail::conjunction<
  31. std::is_nothrow_constructible< typename std::decay< Resource >::type, typename detail::move_or_copy_construct_ref< Resource, typename std::decay< Resource >::type >::type >,
  32. std::is_nothrow_constructible< typename std::decay< Deleter >::type, typename detail::move_or_copy_construct_ref< Deleter, typename std::decay< Deleter >::type >::type >
  33. >::value));
  34. } // namespace scope
  35. } // namespace boost
  36. #include <boost/scope/detail/footer.hpp>
  37. #endif // BOOST_SCOPE_UNIQUE_RESOURCE_FWD_HPP_INCLUDED_