| 1 |
// -*- C++ -*- |
| 2 |
//===----------------------------------------------------------------------===// |
| 3 |
// |
| 4 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 |
// See https://llvm.org/LICENSE.txt for license information. |
| 6 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 |
// |
| 8 |
//===----------------------------------------------------------------------===// |
| 9 |
|
| 10 |
#ifndef _LIBCPP_MEMORY_RESOURCE |
| 11 |
#define _LIBCPP_MEMORY_RESOURCE |
| 12 |
|
| 13 |
/** |
| 14 |
memory_resource synopsis |
| 15 |
|
| 16 |
// C++17 |
| 17 |
|
| 18 |
namespace std::pmr { |
| 19 |
|
| 20 |
class memory_resource; |
| 21 |
|
| 22 |
bool operator==(const memory_resource& a, |
| 23 |
const memory_resource& b) noexcept; |
| 24 |
bool operator!=(const memory_resource& a, |
| 25 |
const memory_resource& b) noexcept; // removed in C++20 |
| 26 |
|
| 27 |
template <class Tp> class polymorphic_allocator; |
| 28 |
|
| 29 |
template <class T1, class T2> |
| 30 |
bool operator==(const polymorphic_allocator<T1>& a, |
| 31 |
const polymorphic_allocator<T2>& b) noexcept; |
| 32 |
template <class T1, class T2> |
| 33 |
bool operator!=(const polymorphic_allocator<T1>& a, |
| 34 |
const polymorphic_allocator<T2>& b) noexcept; // removed in C++20 |
| 35 |
|
| 36 |
// Global memory resources |
| 37 |
memory_resource* set_default_resource(memory_resource* r) noexcept; |
| 38 |
memory_resource* get_default_resource() noexcept; |
| 39 |
memory_resource* new_delete_resource() noexcept; |
| 40 |
memory_resource* null_memory_resource() noexcept; |
| 41 |
|
| 42 |
// Pool resource classes |
| 43 |
struct pool_options; |
| 44 |
class synchronized_pool_resource; |
| 45 |
class unsynchronized_pool_resource; |
| 46 |
class monotonic_buffer_resource; |
| 47 |
|
| 48 |
} // namespace std::pmr |
| 49 |
|
| 50 |
*/ |
| 51 |
|
| 52 |
#include <__config> |
| 53 |
|
| 54 |
#if _LIBCPP_STD_VER >= 17 |
| 55 |
# include <__memory_resource/memory_resource.h> |
| 56 |
# include <__memory_resource/monotonic_buffer_resource.h> |
| 57 |
# include <__memory_resource/polymorphic_allocator.h> |
| 58 |
# include <__memory_resource/pool_options.h> |
| 59 |
# include <__memory_resource/synchronized_pool_resource.h> |
| 60 |
# include <__memory_resource/unsynchronized_pool_resource.h> |
| 61 |
#endif |
| 62 |
|
| 63 |
#include <version> |
| 64 |
|
| 65 |
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 66 |
# pragma GCC system_header |
| 67 |
#endif |
| 68 |
|
| 69 |
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 14 |
| 70 |
# include <cstddef> |
| 71 |
# include <cstdint> |
| 72 |
# include <limits> |
| 73 |
# include <mutex> |
| 74 |
# include <new> |
| 75 |
# include <stdexcept> |
| 76 |
# include <tuple> |
| 77 |
#endif |
| 78 |
|
| 79 |
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 |
| 80 |
# include <stdexcept> |
| 81 |
#endif |
| 82 |
|
| 83 |
#endif /* _LIBCPP_MEMORY_RESOURCE */ |