From 4eef16170014f75f4291ae335a271900f89eaedf Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Fri, 20 Jan 2023 15:12:54 -0800 Subject: 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(-) (limited to 'absl/memory') diff --git a/absl/memory/memory.h b/absl/memory/memory.h index e5ff0e65..3508135c 100644 --- a/absl/memory/memory.h +++ b/absl/memory/memory.h @@ -158,6 +158,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. @@ -175,357 +195,6 @@ struct ExtractOr>> { template