diff --git a/libcxx/include/memory b/libcxx/include/memory --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -80,7 +80,7 @@ typedef Alloc::is_always_equal | is_empty is_always_equal; - template using rebind_alloc = Alloc::rebind::other | Alloc; + template using rebind_alloc = Alloc::rebind::other | Alloc; template using rebind_traits = allocator_traits>; static pointer allocate(allocator_type& a, size_type n); // [[nodiscard]] in C++20 @@ -101,7 +101,7 @@ }; template <> -class allocator +class allocator // deprecated in C++17, removed in C++20 { public: typedef void* pointer; @@ -115,30 +115,37 @@ class allocator { public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef T* pointer; - typedef const T* const_pointer; - typedef typename add_lvalue_reference::type reference; - typedef typename add_lvalue_reference::type const_reference; - typedef T value_type; + typedef size_t size_type; // deprecated in C++17, removed in C++20 + typedef ptrdiff_t difference_type; // deprecated in C++17, removed in C++20 + typedef T* pointer; // deprecated in C++17, removed in C++20 + typedef const T* const_pointer; // deprecated in C++17, removed in C++20 + typedef typename add_lvalue_reference::type + reference; // deprecated in C++17, removed in C++20 + typedef typename add_lvalue_reference::type + const_reference; // deprecated in C++17, removed in C++20 - template struct rebind {typedef allocator other;}; + typedef T value_type; + + template struct rebind {typedef allocator other;}; // deprecated in C++17, removed in C++20 + + typedef true_type propagate_on_container_move_assignment; + typedef true_type is_always_equal; constexpr allocator() noexcept; // constexpr in C++20 constexpr allocator(const allocator&) noexcept; // constexpr in C++20 template constexpr allocator(const allocator&) noexcept; // constexpr in C++20 ~allocator(); - pointer address(reference x) const noexcept; - const_pointer address(const_reference x) const noexcept; - pointer allocate(size_type, allocator::const_pointer hint = 0); - void deallocate(pointer p, size_type n) noexcept; - size_type max_size() const noexcept; + pointer address(reference x) const noexcept; // deprecated in C++17, removed in C++20 + const_pointer address(const_reference x) const noexcept; // deprecated in C++17, removed in C++20 + T* allocate(size_t n, const void* hint); // deprecated in C++17, removed in C++20 + T* allocate(size_t n); + void deallocate(T* p, size_t n) noexcept; + size_type max_size() const noexcept; // deprecated in C++17, removed in C++20 template - void construct(U* p, Args&&... args); + void construct(U* p, Args&&... args); // deprecated in C++17, removed in C++20 template - void destroy(U* p); + void destroy(U* p); // deprecated in C++17, removed in C++20 }; template @@ -705,8 +712,9 @@ template class allocator; +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS) template <> -class _LIBCPP_TEMPLATE_VIS allocator +class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator { public: typedef void* pointer; @@ -717,7 +725,7 @@ }; template <> -class _LIBCPP_TEMPLATE_VIS allocator +class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator { public: typedef const void* pointer; @@ -726,6 +734,7 @@ template struct rebind {typedef allocator<_Up> other;}; }; +#endif // pointer_traits @@ -832,16 +841,12 @@ typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::difference_type type; }; +template +struct __has_rebind : false_type {}; + template -struct __has_rebind -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Xp::template rebind<_Up>* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_rebind<_Tp, _Up, + typename __void_t >::type> : true_type {}; template ::value> struct __pointer_traits_rebind @@ -1255,7 +1260,9 @@ private: struct __two {char __lx; char __lxx;}; template static __two __test(...); + _LIBCPP_SUPPRESS_DEPRECATED_PUSH template static char __test(typename _Xp::template rebind<_Up>::other* = 0); + _LIBCPP_SUPPRESS_DEPRECATED_POP public: static const bool value = sizeof(__test<_Tp>(0)) == 1; }; @@ -1269,7 +1276,9 @@ template ::value> struct __allocator_traits_rebind { + _LIBCPP_SUPPRESS_DEPRECATED_PUSH typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up>::other type; + _LIBCPP_SUPPRESS_DEPRECATED_POP }; #ifndef _LIBCPP_HAS_NO_VARIADICS @@ -1277,7 +1286,9 @@ template