mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 12:07:05 +08:00
Use std::make_unique_for_overwrite to implement
absl::make_unique_for_overwrite when it is available PiperOrigin-RevId: 924723063 Change-Id: Id3981612b1880c2bee505ca49ae079dc713ac746
This commit is contained in:
committed by
Copybara-Service
parent
fe126c727b
commit
c1e1979605
@@ -96,6 +96,11 @@ std::unique_ptr<T> WrapUnique(T* ptr) {
|
||||
// should use `std::make_unique`.
|
||||
using std::make_unique;
|
||||
|
||||
#if defined(__cpp_lib_smart_ptr_for_overwrite) && \
|
||||
__cpp_lib_smart_ptr_for_overwrite >= 202002L
|
||||
using std::make_unique_for_overwrite;
|
||||
#else
|
||||
|
||||
namespace memory_internal {
|
||||
|
||||
// Traits to select proper overload and return type for
|
||||
@@ -143,6 +148,8 @@ template <typename T, typename... Args>
|
||||
typename memory_internal::MakeUniqueResult<T>::invalid
|
||||
make_unique_for_overwrite(Args&&... /* args */) = delete;
|
||||
|
||||
#endif // __cpp_lib_smart_ptr_for_overwrite
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function Template: RawPtr()
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user