null_resource.hpp 858 B

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // Copyright (c) 2020 Vinnie Falco (vinnie.falco@gmail.com)
  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/json/detail/config.hpp>
  12. #include <boost/json/memory_resource.hpp>
  13. namespace boost {
  14. namespace json {
  15. /** Return a pointer to the null resource.
  16. This memory resource always throws the exception
  17. `std::bad_alloc` in calls to `allocate`.
  18. @par Complexity
  19. Constant.
  20. @par Exception Safety
  21. No-throw guarantee.
  22. */
  23. BOOST_JSON_DECL
  24. memory_resource*
  25. get_null_resource() noexcept;
  26. } // namespace json
  27. } // namespace boost
  28. #endif