summaryrefslogtreecommitdiff
path: root/absl/container/inlined_vector.h
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@google.com>2021-04-08 10:23:55 -0400
committerGravatar Benjamin Barenblat <bbaren@google.com>2021-04-08 10:23:55 -0400
commitfeac56827dd1f0d159ea0bcf2ce37ef1990ac743 (patch)
treebc8ca767be02a5b22118108f9712b72ec64064c3 /absl/container/inlined_vector.h
parent2b91b17d526b464840a3f45504c594cdb50152c5 (diff)
parent997aaf3a28308eba1b9156aa35ab7bca9688e9f6 (diff)
Merge new upstream LTS 20210324.0
Diffstat (limited to 'absl/container/inlined_vector.h')
-rw-r--r--absl/container/inlined_vector.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/absl/container/inlined_vector.h b/absl/container/inlined_vector.h
index 90bb96e8..7c182342 100644
--- a/absl/container/inlined_vector.h
+++ b/absl/container/inlined_vector.h
@@ -167,11 +167,13 @@ class InlinedVector {
// Creates an inlined vector by copying the contents of `other` using `alloc`.
InlinedVector(const InlinedVector& other, const allocator_type& alloc)
: storage_(alloc) {
- if (IsMemcpyOk::value && !other.storage_.GetIsAllocated()) {
+ if (other.empty()) {
+ // Empty; nothing to do.
+ } else if (IsMemcpyOk::value && !other.storage_.GetIsAllocated()) {
+ // Memcpy-able and do not need allocation.
storage_.MemcpyFrom(other.storage_);
} else {
- storage_.Initialize(IteratorValueAdapter<const_pointer>(other.data()),
- other.size());
+ storage_.InitFrom(other.storage_);
}
}