summaryrefslogtreecommitdiff
path: root/absl/synchronization
diff options
context:
space:
mode:
authorGravatar Rose <83477269+AtariDreams@users.noreply.github.com>2023-03-16 17:32:09 -0400
committerGravatar Rose <83477269+AtariDreams@users.noreply.github.com>2023-04-19 13:35:57 -0400
commita26fc02d1ea9a2f0770c1297db0a049b9dd4b941 (patch)
tree1107f6d9ab367d24ab7975511329a845a30637ca /absl/synchronization
parente85868cbef04e8e8ff518e09b6af3970bbe5d2eb (diff)
Prefer copy_n and fill_n over copy and fill where appropriate.
This lets us avoid having to do the addition manually.
Diffstat (limited to 'absl/synchronization')
-rw-r--r--absl/synchronization/internal/graphcycles.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/absl/synchronization/internal/graphcycles.cc b/absl/synchronization/internal/graphcycles.cc
index feec4581..01489544 100644
--- a/absl/synchronization/internal/graphcycles.cc
+++ b/absl/synchronization/internal/graphcycles.cc
@@ -114,7 +114,7 @@ class Vec {
if (src->ptr_ == src->space_) {
// Need to actually copy
resize(src->size_);
- std::copy(src->ptr_, src->ptr_ + src->size_, ptr_);
+ std::copy_n(src->ptr_, src->size_, ptr_);
src->size_ = 0;
} else {
Discard();
@@ -148,7 +148,7 @@ class Vec {
size_t request = static_cast<size_t>(capacity_) * sizeof(T);
T* copy = static_cast<T*>(
base_internal::LowLevelAlloc::AllocWithArena(request, arena));
- std::copy(ptr_, ptr_ + size_, copy);
+ std::copy_n(ptr_, size_, copy);
Discard();
ptr_ = copy;
}