diff options
Diffstat (limited to 'libcxx/include/experimental/memory_resource')
| -rw-r--r-- | libcxx/include/experimental/memory_resource | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/libcxx/include/experimental/memory_resource b/libcxx/include/experimental/memory_resource index f7b19aafd40f..f107f109203f 100644 --- a/libcxx/include/experimental/memory_resource +++ b/libcxx/include/experimental/memory_resource @@ -65,16 +65,16 @@ namespace pmr { */ #include <__assert> // all public C++ headers provide the assertion handler -#include <__tuple> +#include <__memory/allocator_traits.h> #include <__utility/move.h> #include <cstddef> #include <cstdlib> #include <experimental/__config> #include <experimental/__memory> #include <limits> -#include <memory> #include <new> #include <stdexcept> +#include <tuple> #include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -86,6 +86,12 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR +#define _LIBCPP_DEPCREATED_MEMORY_RESOURCE(name) \ + _LIBCPP_DEPRECATED_("'std::experimental::pmr::" name \ + "' is deprecated and will be removed in LLVM 18. Use 'std::pmr::" name "' instead.") + +#ifndef _LIBCPP_CXX03_LANG + // Round __s up to next multiple of __a. inline _LIBCPP_INLINE_VISIBILITY size_t __aligned_allocation_size(size_t __s, size_t __a) _NOEXCEPT @@ -95,7 +101,7 @@ size_t __aligned_allocation_size(size_t __s, size_t __a) _NOEXCEPT } // 8.5, memory.resource -class _LIBCPP_TYPE_VIS memory_resource +class _LIBCPP_DEPCREATED_MEMORY_RESOURCE("memory_resource") _LIBCPP_TYPE_VIS memory_resource { static const size_t __max_align = _LIBCPP_ALIGNOF(max_align_t); @@ -123,37 +129,37 @@ private: }; // 8.5.4, memory.resource.eq -inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_DEPCREATED_MEMORY_RESOURCE("operator==(memory_resource, memory_resource)") inline _LIBCPP_INLINE_VISIBILITY bool operator==(memory_resource const & __lhs, memory_resource const & __rhs) _NOEXCEPT { return &__lhs == &__rhs || __lhs.is_equal(__rhs); } -inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_DEPCREATED_MEMORY_RESOURCE("operator!=(memory_resource, memory_resource)") inline _LIBCPP_INLINE_VISIBILITY bool operator!=(memory_resource const & __lhs, memory_resource const & __rhs) _NOEXCEPT { return !(__lhs == __rhs); } -_LIBCPP_FUNC_VIS +_LIBCPP_DEPCREATED_MEMORY_RESOURCE("new_delete_resource()") _LIBCPP_FUNC_VIS memory_resource * new_delete_resource() _NOEXCEPT; -_LIBCPP_FUNC_VIS +_LIBCPP_DEPCREATED_MEMORY_RESOURCE("null_memory_resource()") _LIBCPP_FUNC_VIS memory_resource * null_memory_resource() _NOEXCEPT; -_LIBCPP_FUNC_VIS +_LIBCPP_DEPCREATED_MEMORY_RESOURCE("get_default_resource()") _LIBCPP_FUNC_VIS memory_resource * get_default_resource() _NOEXCEPT; -_LIBCPP_FUNC_VIS +_LIBCPP_DEPCREATED_MEMORY_RESOURCE("set_default_resource()") _LIBCPP_FUNC_VIS memory_resource * set_default_resource(memory_resource * __new_res) _NOEXCEPT; // 8.6, memory.polymorphic.allocator.class // 8.6.1, memory.polymorphic.allocator.overview template <class _ValueType> -class _LIBCPP_TEMPLATE_VIS polymorphic_allocator +class _LIBCPP_DEPCREATED_MEMORY_RESOURCE("polymorphic_allocator") _LIBCPP_TEMPLATE_VIS polymorphic_allocator { public: typedef _ValueType value_type; @@ -314,6 +320,7 @@ private: // 8.6.4, memory.polymorphic.allocator.eq template <class _Tp, class _Up> +_LIBCPP_DEPCREATED_MEMORY_RESOURCE("operator==(const polymorphic_allocator&, const polymorphic_allocator&)") inline _LIBCPP_INLINE_VISIBILITY bool operator==(polymorphic_allocator<_Tp> const & __lhs, polymorphic_allocator<_Up> const & __rhs) _NOEXCEPT @@ -322,6 +329,7 @@ bool operator==(polymorphic_allocator<_Tp> const & __lhs, } template <class _Tp, class _Up> +_LIBCPP_DEPCREATED_MEMORY_RESOURCE("operator!=(const polymorphic_allocator&, const polymorphic_allocator&)") inline _LIBCPP_INLINE_VISIBILITY bool operator!=(polymorphic_allocator<_Tp> const & __lhs, polymorphic_allocator<_Up> const & __rhs) _NOEXCEPT @@ -331,6 +339,7 @@ bool operator!=(polymorphic_allocator<_Tp> const & __lhs, // 8.7, memory.resource.adaptor +_LIBCPP_SUPPRESS_DEPRECATED_PUSH // 8.7.1, memory.resource.adaptor.overview template <class _CharAlloc> class _LIBCPP_TEMPLATE_VIS __resource_adaptor_imp @@ -379,7 +388,7 @@ public: // 8.7.3, memory.resource.adaptor.mem private: - virtual void * do_allocate(size_t __bytes, size_t) + void * do_allocate(size_t __bytes, size_t) override { if (__bytes > __max_size()) __throw_bad_array_new_length(); @@ -387,7 +396,7 @@ private: return __alloc_.allocate(__s); } - virtual void do_deallocate(void * __p, size_t __bytes, size_t) + void do_deallocate(void * __p, size_t __bytes, size_t) override { _LIBCPP_ASSERT(__bytes <= __max_size(), "do_deallocate called for size which exceeds the maximum allocation size"); @@ -395,7 +404,7 @@ private: __alloc_.deallocate((_ValueType*)__p, __s); } - virtual bool do_is_equal(memory_resource const & __other) const _NOEXCEPT { + bool do_is_equal(memory_resource const & __other) const _NOEXCEPT override { __resource_adaptor_imp const * __p = dynamic_cast<__resource_adaptor_imp const *>(&__other); return __p ? __alloc_ == __p->__alloc_ : false; @@ -411,9 +420,24 @@ template <class _Alloc> using resource_adaptor = __resource_adaptor_imp< typename allocator_traits<_Alloc>::template rebind_alloc<char> >; +_LIBCPP_SUPPRESS_DEPRECATED_POP + +#endif // _LIBCPP_CXX03_LANG _LIBCPP_END_NAMESPACE_LFTS_PMR _LIBCPP_POP_MACROS +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <atomic> +# include <climits> +# include <concepts> +# include <cstring> +# include <ctime> +# include <iterator> +# include <memory> +# include <ratio> +# include <variant> +#endif + #endif /* _LIBCPP_EXPERIMENTAL_MEMORY_RESOURCE */ |
