2 // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
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)
7 // Official repository: https://github.com/boostorg/json
10 #ifndef BOOST_JSON_DEFAULT_RESOURCE_HPP
11 #define BOOST_JSON_DEFAULT_RESOURCE_HPP
13 #include <boost/json/detail/config.hpp>
21 #pragma warning(disable: 4251) // class needs to have dll-interface to be used by clients of class
22 #pragma warning(disable: 4275) // non dll-interface class used as base for dll-interface class
25 // A simple memory resource that uses operator new and delete.
29 default_resource final
30 : public memory_resource
34 #ifndef BOOST_JSON_WEAK_CONSTINIT
35 # ifndef BOOST_JSON_NO_DESTROY
36 static holder instance_;
39 static default_resource instance_;
48 #ifdef BOOST_JSON_WEAK_CONSTINIT
49 static default_resource instance_;
51 return reinterpret_cast<memory_resource*>(
52 reinterpret_cast<std::uintptr_t*>(
61 std::size_t) override;
67 std::size_t) override;
71 memory_resource const& mr) const noexcept override;
78 union default_resource::
81 #ifndef BOOST_JSON_WEAK_CONSTINIT