summaryrefslogtreecommitdiff
path: root/absl/random
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/random
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/random')
-rw-r--r--absl/random/internal/nanobenchmark.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/absl/random/internal/nanobenchmark.cc b/absl/random/internal/nanobenchmark.cc
index c9181813..0f31a7d5 100644
--- a/absl/random/internal/nanobenchmark.cc
+++ b/absl/random/internal/nanobenchmark.cc
@@ -361,7 +361,7 @@ void CountingSort(T* values, size_t num_values) {
// Write that many copies of each unique value to the array.
T* ABSL_RANDOM_INTERNAL_RESTRICT p = values;
for (const auto& value_count : unique) {
- std::fill(p, p + value_count.second, value_count.first);
+ std::fill_n(p, value_count.second, value_count.first);
p += value_count.second;
}
ABSL_RAW_CHECK(p == values + num_values, "Did not produce enough output");