diff options
author | Aaron Jacobs <jacobsa@google.com> | 2023-04-11 19:54:23 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-04-11 19:55:09 -0700 |
commit | 5ad663b790c02c7fe11085f6ebc5e284e4432733 (patch) | |
tree | c69e4b6dde19a692ff36e218d0b05f15ade940f4 /absl/container/internal/inlined_vector.h | |
parent | 156b10f550950cecdd484f9bfcec30bec73ea406 (diff) |
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
Diffstat (limited to 'absl/container/internal/inlined_vector.h')
-rw-r--r-- | absl/container/internal/inlined_vector.h | 12 |
1 files changed, 1 insertions, 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<T, N, A>::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<ValueType<A>>::value && - std::is_same<A, std::allocator<ValueType<A>>>::value && - absl::is_trivially_copy_assignable<ValueType<A>>::value && - absl::is_trivially_destructible<ValueType<A>>::value) { + std::is_same<A, std::allocator<ValueType<A>>>::value) { std::memcpy(reinterpret_cast<char*>(dst), reinterpret_cast<const char*>(src), n * sizeof(ValueType<A>)); } else { |