null_resource.hpp 895 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // Copyright (c) 2020 Vinnie Falco ([email protected])
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // Official repository: https://github.com/boostorg/json
  8. //
  9. #ifndef BOOST_JSON_NULL_RESOURCE_HPP
  10. #define BOOST_JSON_NULL_RESOURCE_HPP
  11. #include <boost/container/pmr/memory_resource.hpp>
  12. #include <boost/json/detail/config.hpp>
  13. #include <boost/json/memory_resource.hpp>
  14. namespace boost {
  15. namespace json {
  16. /** Return a pointer to the null resource.
  17. This memory resource always throws the exception
  18. `std::bad_alloc` in calls to `allocate`.
  19. @par Complexity
  20. Constant.
  21. @par Exception Safety
  22. No-throw guarantee.
  23. */
  24. BOOST_JSON_DECL
  25. boost::container::pmr::memory_resource*
  26. get_null_resource() noexcept;
  27. } // namespace json
  28. } // namespace boost
  29. #endif