diff options
author | Abseil Team <absl-team@google.com> | 2021-09-22 12:57:35 -0700 |
---|---|---|
committer | Andy Getz <durandal@google.com> | 2021-09-22 16:01:25 -0400 |
commit | 020619c4aa68d13dfbdd6107a373912bb5ea85af (patch) | |
tree | 7dd82abe7d166ff8c4a79fd2ff50fd3a0d2f128b /absl/container/inlined_vector.h | |
parent | d4af654d971cc46cde6213269a364cdf170fe0ce (diff) | |
download | abseil-020619c4aa68d13dfbdd6107a373912bb5ea85af.tar.gz abseil-020619c4aa68d13dfbdd6107a373912bb5ea85af.tar.bz2 abseil-020619c4aa68d13dfbdd6107a373912bb5ea85af.zip |
Export of internal Abseil changes
--
336f161ad8cb2cc3e1a6bbcbbb8c5b692ee59789 by Derek Mauro <dmauro@google.com>:
Internal change
PiperOrigin-RevId: 398308807
--
80d512823d17561a45feca81f37713a91a175349 by Abseil Team <absl-team@google.com>:
Internal change.
PiperOrigin-RevId: 398257218
--
f1f9792000355eb1d0c11b17800048491662a218 by Abseil Team <absl-team@google.com>:
Fix documentation for btree_multi{map,set}::merge to match behavior for elements with equivalent keys.
PiperOrigin-RevId: 398071060
--
8a9a302aebf2419e83f0c7dc5a63c33d26b807a3 by James Y Knight <jyknight@google.com>:
Silence -Wunused-value warning newly emitted by ToT Clang.
The value is being intentionally ignored, as the purpose of the call is only to eliminate this overload via SFINAE when `GenT{}` is not constant evaluable.
PiperOrigin-RevId: 397861294
GitOrigin-RevId: 336f161ad8cb2cc3e1a6bbcbbb8c5b692ee59789
Change-Id: I946e1d22619f92ce6a424c8c13a20a50b39ed463
Diffstat (limited to 'absl/container/inlined_vector.h')
-rw-r--r-- | absl/container/inlined_vector.h | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/absl/container/inlined_vector.h b/absl/container/inlined_vector.h index 37e5fef8..df9e0991 100644 --- a/absl/container/inlined_vector.h +++ b/absl/container/inlined_vector.h @@ -207,8 +207,8 @@ class InlinedVector { other.storage_.SetInlinedSize(0); } else if (other.storage_.GetIsAllocated()) { - storage_.SetAllocatedData(other.storage_.GetAllocatedData(), - other.storage_.GetAllocatedCapacity()); + storage_.SetAllocation({other.storage_.GetAllocatedData(), + other.storage_.GetAllocatedCapacity()}); storage_.SetAllocatedSize(other.storage_.GetSize()); other.storage_.SetInlinedSize(0); @@ -242,8 +242,8 @@ class InlinedVector { other.storage_.SetInlinedSize(0); } else if ((storage_.GetAllocator() == other.storage_.GetAllocator()) && other.storage_.GetIsAllocated()) { - storage_.SetAllocatedData(other.storage_.GetAllocatedData(), - other.storage_.GetAllocatedCapacity()); + storage_.SetAllocation({other.storage_.GetAllocatedData(), + other.storage_.GetAllocatedCapacity()}); storage_.SetAllocatedSize(other.storage_.GetSize()); other.storage_.SetInlinedSize(0); @@ -735,15 +735,12 @@ class InlinedVector { // `InlinedVector::shrink_to_fit()` // - // Reduces memory usage by freeing unused memory. After being called, calls to - // `capacity()` will be equal to `max(N, size())`. + // Attempts to reduce memory usage by moving elements to (or keeping elements + // in) the smallest available buffer sufficient for containing `size()` + // elements. // - // If `size() <= N` and the inlined vector contains allocated memory, the - // elements will all be moved to the inlined space and the allocated memory - // will be deallocated. - // - // If `size() > N` and `size() < capacity()`, the elements will be moved to a - // smaller allocation. + // If `size()` is sufficiently small, the elements will be moved into (or kept + // in) the inlined space. void shrink_to_fit() { if (storage_.GetIsAllocated()) { storage_.ShrinkToFit(); |