From 5ad663b790c02c7fe11085f6ebc5e284e4432733 Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Tue, 11 Apr 2023 19:54:23 -0700 Subject: inlined_vector: fix incorrect restrictions on the copy constructor fast path. This has nothing to do with copy assignment or with destruction. PiperOrigin-RevId: 523576913 Change-Id: Iddb6ab73bcfd8b01a29880cdf4db4bc2b5aead8a --- absl/container/internal/inlined_vector.h | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/absl/container/internal/inlined_vector.h b/absl/container/internal/inlined_vector.h index e1404955..451fb191 100644 --- a/absl/container/internal/inlined_vector.h +++ b/absl/container/internal/inlined_vector.h @@ -595,18 +595,8 @@ void Storage::InitFrom(const Storage& other) { // Fast path: if the value type is trivially copy constructible and we know // the allocator doesn't do anything fancy, then we know it is legal for us to // simply memcpy the other vector's elements. - // - // TODO(b/274984172): the condition on copy-assignability is here only for - // historical reasons. It doesn't make semantic sense: we don't need to be - // able to copy assign here, we are doing an "as-if" copy construction. - // - // TODO(b/274984172): the condition on trivial destructibility is here only - // for historical reasons. It doesn't make sense: there is no destruction - // here. if (absl::is_trivially_copy_constructible>::value && - std::is_same>>::value && - absl::is_trivially_copy_assignable>::value && - absl::is_trivially_destructible>::value) { + std::is_same>>::value) { std::memcpy(reinterpret_cast(dst), reinterpret_cast(src), n * sizeof(ValueType)); } else { -- cgit v1.2.3