2
0
mirror of https://github.com/boostorg/json.git synced 2026-02-10 23:42:19 +00:00

Refactor memory resource includes

This commit is contained in:
Vinnie Falco
2020-04-17 14:05:51 -07:00
parent fd29fd2749
commit fc0b74f986
7 changed files with 52 additions and 7 deletions

View File

@@ -20,13 +20,9 @@ namespace json {
/// The type of string view used by the library.
using string_view = boost::string_view;
/// The type of memory_resource used by the library.
using memory_resource = boost::container::pmr::memory_resource;
#else
using string_view = std::string_view;
using memory_resource = std::pmr::memory_resource;
#endif

View File

@@ -13,12 +13,10 @@
#ifndef BOOST_JSON_STANDALONE
# include <boost/config.hpp>
# include <boost/assert.hpp>
# include <boost/container/pmr/memory_resource.hpp>
# include <boost/utility/string_view.hpp>
# include <boost/throw_exception.hpp>
#else
# include <cassert>
# include <memory_resource>
# include <string_view>
#endif
#include <cstdint>

View File

@@ -10,8 +10,9 @@
#ifndef BOOST_JSON_DETAIL_COUNTED_RESOURCE_HPP
#define BOOST_JSON_DETAIL_COUNTED_RESOURCE_HPP
#include <boost/json/config.hpp>
#include <boost/json/memory_resource.hpp>
#include <atomic>
#include <utility>
namespace boost {
namespace json {

View File

@@ -0,0 +1,37 @@
//
// Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Official repository: https://github.com/vinniefalco/json
//
#ifndef BOOST_JSON_MEMORY_RESOURCE_HPP
#define BOOST_JSON_MEMORY_RESOURCE_HPP
#include <boost/json/config.hpp>
#ifndef BOOST_JSON_STANDALONE
# include <boost/container/pmr/memory_resource.hpp>
#else
# include <memory_resource>
#endif
namespace boost {
namespace json {
#ifndef BOOST_JSON_STANDALONE
/// The type of memory_resource used by the library.
using memory_resource = boost::container::pmr::memory_resource;
#else
using memory_resource = std::pmr::memory_resource;
#endif
} // json
} // boost
#endif

View File

@@ -11,6 +11,7 @@
#define BOOST_JSON_STORAGE_PTR_HPP
#include <boost/json/config.hpp>
#include <boost/json/memory_resource.hpp>
#include <boost/json/detail/counted_resource.hpp>
#include <boost/json/detail/default_resource.hpp>
#include <cstddef>