diff options
author | Abseil Team <absl-team@google.com> | 2021-09-29 09:40:33 -0700 |
---|---|---|
committer | vslashg <gfalcon@google.com> | 2021-09-30 10:00:30 -0400 |
commit | 4167eab063636a1fadcd571e0a762ff67d742c25 (patch) | |
tree | 3ef02de30fe5dbddb6309ad6c73c4a858b863f5f /absl/container | |
parent | 7143e49e74857a009e16c51f6076eb197b6ccb49 (diff) |
Export of internal Abseil changes
--
506fa3e10b3d8399ad937c32ecea26d1ad4e62bb by Abseil Team <absl-team@google.com>:
Disable ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE when GCC < 8.2.0 is used with libc++
PiperOrigin-RevId: 399707056
--
656b7c7cee87f46a4bc7953618796f82da08e62c by Derek Mauro <dmauro@google.com>:
Remove the MSVC flag implementation from flag.h to help clarify that
methods on absl::Flag<T> are not part of the public API
PiperOrigin-RevId: 399584678
--
a92a9bc156303bc663b84c4b704891ec8f67e333 by Abseil Team <absl-team@google.com>:
Get rid of MemcpyIfAllowed while continuing to suppress erroneous warnings
PiperOrigin-RevId: 399468864
--
5f9a66895f707ba001fb51b88c0c6025f8c872a3 by Abseil Team <absl-team@google.com>:
Use feature testing to check for availability of invoke_result.
Feature testing should be available by C++20, which removes invoke_result.
https://en.cppreference.com/w/cpp/feature_test
PiperOrigin-RevId: 399447373
--
946c0a502b4499dbfcabf1ab93ddde0048288fb4 by CJ Johnson <johnsoncj@google.com>:
Add rvalue-reference qualifier to the Commit method on ConstructionTransaction
PiperOrigin-RevId: 399442206
--
726a4d036eff49aeb6fd0ca2b1775699b6844395 by Greg Falcon <gfalcon@google.com>:
Internal change
PiperOrigin-RevId: 399441870
--
1df6d3f659b88dbac13c3d8e13db23bb3844ece2 by Abseil Team <absl-team@google.com>:
Clang-format whitespace changes
PiperOrigin-RevId: 399281271
--
4a828cde95a07421d699ebac775b37810624214f by Derek Mauro <dmauro@google.com>:
Internal change
PiperOrigin-RevId: 399234071
--
e520c72b34ba2f98668c889139001f8276243d31 by Greg Falcon <gfalcon@google.com>:
Import of CCTZ from GitHub.
PiperOrigin-RevId: 399233662
GitOrigin-RevId: 506fa3e10b3d8399ad937c32ecea26d1ad4e62bb
Change-Id: I92b9176d2387c08eb167f9268efa78b55b8e09c2
Diffstat (limited to 'absl/container')
-rw-r--r-- | absl/container/internal/inlined_vector.h | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/absl/container/internal/inlined_vector.h b/absl/container/internal/inlined_vector.h index e2ecf46c..1d7d6cda 100644 --- a/absl/container/internal/inlined_vector.h +++ b/absl/container/internal/inlined_vector.h @@ -126,23 +126,6 @@ struct MallocAdapter { } }; -// If kUseMemcpy is true, memcpy(dst, src, n); else do nothing. -// Useful to avoid compiler warnings when memcpy() is used for T values -// that are not trivially copyable in non-reachable code. -template <bool kUseMemcpy> -inline void MemcpyIfAllowed(void* dst, const void* src, size_t n); - -// memcpy when allowed. -template <> -inline void MemcpyIfAllowed<true>(void* dst, const void* src, size_t n) { - memcpy(dst, src, n); -} - -// Do nothing for types that are not memcpy-able. This function is only -// called from non-reachable branches. -template <> -inline void MemcpyIfAllowed<false>(void*, const void*, size_t) {} - template <typename A, typename ValueAdapter> void ConstructElements(NoTypeDeduction<A>& allocator, Pointer<A> construct_first, ValueAdapter& values, @@ -288,7 +271,7 @@ class ConstructionTransaction { GetData() = data; GetSize() = size; } - void Commit() { + void Commit() && { GetData() = nullptr; GetSize() = 0; } @@ -511,7 +494,8 @@ void Storage<T, N, A>::InitFrom(const Storage& other) { src = other.GetAllocatedData(); } if (IsMemcpyOk<A>::value) { - MemcpyIfAllowed<IsMemcpyOk<A>::value>(dst, src, sizeof(dst[0]) * n); + std::memcpy(reinterpret_cast<char*>(dst), + reinterpret_cast<const char*>(src), n * sizeof(ValueType<A>)); } else { auto values = IteratorValueAdapter<A, ConstPointer<A>>(src); ConstructElements<A>(GetAllocator(), dst, values, n); @@ -628,7 +612,7 @@ auto Storage<T, N, A>::Resize(ValueAdapter values, SizeType<A> new_size) ConstructElements<A>(alloc, new_data, move_values, size); DestroyElements<A>(alloc, base, size); - construction_tx.Commit(); + std::move(construction_tx).Commit(); DeallocateIfAllocated(); SetAllocation(std::move(allocation_tx).Release()); SetIsAllocated(); @@ -668,8 +652,8 @@ auto Storage<T, N, A>::Insert(ConstIterator<A> pos, ValueAdapter values, DestroyElements<A>(GetAllocator(), storage_view.data, storage_view.size); - construction_tx.Commit(); - move_construction_tx.Commit(); + std::move(construction_tx).Commit(); + std::move(move_construction_tx).Commit(); DeallocateIfAllocated(); SetAllocation(std::move(allocation_tx).Release()); @@ -721,7 +705,7 @@ auto Storage<T, N, A>::Insert(ConstIterator<A> pos, ValueAdapter values, ConstructElements<A>(GetAllocator(), insert_construction.data(), values, insert_construction.size()); - move_construction_tx.Commit(); + std::move(move_construction_tx).Commit(); AddSize(insert_count); return Iterator<A>(storage_view.data + insert_index); |