[libc++] Un-deprecate and un-remove some members of std::allocator
This implements the part of P0619R4 related to the default allocator.
This is incredibly important, since otherwise there is an ABI break
between C++17 and C++20 w.r.t. the default allocator's size_type on
platforms where std::size_t is not the same as std::make_unsigned<std::ptrdiff_t>.
Cr-Mirrored-From: https://chromium.googlesource.com/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 316d336dca7f64f048507f155166daa3821db957
diff --git a/include/memory b/include/memory
index 54176f4..ebb0a72 100644
--- a/include/memory
+++ b/include/memory
@@ -115,8 +115,8 @@
class allocator
{
public:
- 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 size_t size_type;
+ typedef ptrdiff_t difference_type;
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<T>::type
@@ -1748,9 +1748,9 @@
class _LIBCPP_TEMPLATE_VIS allocator
{
public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t size_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef ptrdiff_t difference_type;
_LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp* pointer;
_LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer;
_LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp& reference;
@@ -1816,9 +1816,9 @@
class _LIBCPP_TEMPLATE_VIS allocator<const _Tp>
{
public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t size_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef ptrdiff_t difference_type;
_LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* pointer;
_LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer;
_LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& reference;