From 5c77799d5dfcd9c4736621ad9b5fd5da611e6518 Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Fri, 20 Jan 2023 15:12:54 -0800 Subject: [PATCH] Update absl::allocator_traits and absl::pointer_traits to always use std::allocator_traits and std::pointer traits. Note that the reason given in the comments for these implementations was incorrect. Both of these exist in C++11, but not all compilers had working implementations, so Abseil backfiled them. All supported compilers now have working implementations. https://en.cppreference.com/w/cpp/memory/allocator_traits https://en.cppreference.com/w/cpp/memory/pointer_traits Documentation has been updated to recommend the std:: spellings. Fixes #1366 PiperOrigin-RevId: 503532746 Change-Id: Ia437f65a4c752581195dc582a41831b479d096c6 --- absl/memory/memory.h | 371 ++----------------------------------- absl/memory/memory_test.cc | 332 --------------------------------- 2 files changed, 20 insertions(+), 683 deletions(-) diff --git a/absl/memory/memory.h b/absl/memory/memory.h index d6332606..2b99c190 100644 --- a/absl/memory/memory.h +++ b/absl/memory/memory.h @@ -248,6 +248,26 @@ std::weak_ptr WeakenPtr(const std::shared_ptr& ptr) { return std::weak_ptr(ptr); } +// ----------------------------------------------------------------------------- +// Class Template: pointer_traits +// ----------------------------------------------------------------------------- +// +// Historical note: Abseil once provided an implementation of +// `std::pointer_traits` for platforms that had not yet provided it. Those +// platforms are no longer supported. New code should simply use +// `std::pointer_traits`. +using std::pointer_traits; + +// ----------------------------------------------------------------------------- +// Class Template: allocator_traits +// ----------------------------------------------------------------------------- +// +// Historical note: Abseil once provided an implementation of +// `std::allocator_traits` for platforms that had not yet provided it. Those +// platforms are no longer supported. New code should simply use +// `std::allocator_traits`. +using std::allocator_traits; + namespace memory_internal { // ExtractOr::type evaluates to E if possible. Otherwise, D. @@ -265,357 +285,6 @@ struct ExtractOr>> { template