Export of internal Abseil changes
-- 0e867881e4b9f388a13d6fa8ed715192460130ab by Abseil Team <absl-team@google.com>: Minor wording change to header comment for Mutex::AwaitWithDeadline(). No functional changes. PiperOrigin-RevId: 306729491 -- fc64361fb831003fa5e6fbb84a9a89338fd2838c by Derek Mauro <dmauro@google.com>: Uses C++20 compatible allocator traits in Abseil types This merges both instances of CountingAllocator in the Abseil codebase. Makes the presubmits test C++20 mode. Fixes #651 PiperOrigin-RevId: 306728102 -- d759e5681b9dd6b7339fc019ed58fb5fdececdc3 by Derek Mauro <dmauro@google.com>: Makes btree's iterator comparisons C++20 compatible See https://stackoverflow.com/questions/60386792/c20-comparison-warning-about-ambiguous-reversed-operator PiperOrigin-RevId: 306702048 -- e9da5f409bc5ddb1bad308f9d8c41213c67a1d1e by Derek Mauro <dmauro@google.com>: Switch a few uses of at() that should have been data() in the implementation of InlinedVector. Use ABSL_HARDENING_ASSERT in resize(). PiperOrigin-RevId: 306670992 GitOrigin-RevId: 0e867881e4b9f388a13d6fa8ed715192460130ab Change-Id: If431f3e5d77097e9901654773552dcc01dface87
This commit is contained in:
parent
71079e42cb
commit
db5773a721
13 changed files with 90 additions and 108 deletions
|
|
@ -351,14 +351,14 @@ class InlinedVector {
|
|||
// Returns a `reference` to the first element of the inlined vector.
|
||||
reference front() {
|
||||
ABSL_HARDENING_ASSERT(!empty());
|
||||
return at(0);
|
||||
return data()[0];
|
||||
}
|
||||
|
||||
// Overload of `InlinedVector::front()` that returns a `const_reference` to
|
||||
// the first element of the inlined vector.
|
||||
const_reference front() const {
|
||||
ABSL_HARDENING_ASSERT(!empty());
|
||||
return at(0);
|
||||
return data()[0];
|
||||
}
|
||||
|
||||
// `InlinedVector::back()`
|
||||
|
|
@ -366,14 +366,14 @@ class InlinedVector {
|
|||
// Returns a `reference` to the last element of the inlined vector.
|
||||
reference back() {
|
||||
ABSL_HARDENING_ASSERT(!empty());
|
||||
return at(size() - 1);
|
||||
return data()[size() - 1];
|
||||
}
|
||||
|
||||
// Overload of `InlinedVector::back()` that returns a `const_reference` to the
|
||||
// last element of the inlined vector.
|
||||
const_reference back() const {
|
||||
ABSL_HARDENING_ASSERT(!empty());
|
||||
return at(size() - 1);
|
||||
return data()[size() - 1];
|
||||
}
|
||||
|
||||
// `InlinedVector::begin()`
|
||||
|
|
@ -524,7 +524,7 @@ class InlinedVector {
|
|||
void assign(InputIterator first, InputIterator last) {
|
||||
size_type i = 0;
|
||||
for (; i < size() && first != last; ++i, static_cast<void>(++first)) {
|
||||
at(i) = *first;
|
||||
data()[i] = *first;
|
||||
}
|
||||
|
||||
erase(data() + i, data() + size());
|
||||
|
|
@ -537,7 +537,10 @@ class InlinedVector {
|
|||
//
|
||||
// NOTE: if `n` is smaller than `size()`, extra elements are destroyed. If `n`
|
||||
// is larger than `size()`, new elements are value-initialized.
|
||||
void resize(size_type n) { storage_.Resize(DefaultValueAdapter(), n); }
|
||||
void resize(size_type n) {
|
||||
ABSL_HARDENING_ASSERT(n <= max_size());
|
||||
storage_.Resize(DefaultValueAdapter(), n);
|
||||
}
|
||||
|
||||
// Overload of `InlinedVector::resize(...)` that resizes the inlined vector to
|
||||
// contain `n` elements.
|
||||
|
|
@ -545,6 +548,7 @@ class InlinedVector {
|
|||
// NOTE: if `n` is smaller than `size()`, extra elements are destroyed. If `n`
|
||||
// is larger than `size()`, new elements are copied-constructed from `v`.
|
||||
void resize(size_type n, const_reference v) {
|
||||
ABSL_HARDENING_ASSERT(n <= max_size());
|
||||
storage_.Resize(CopyValueAdapter(v), n);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue