From 579b1800534fa08950278169c45db4b3be09b42c Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 20 Jul 2020 13:02:10 +0200 Subject: BLI: add Vector/Array.fill methods --- source/blender/blenlib/BLI_vector.hh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/blender/blenlib/BLI_vector.hh') diff --git a/source/blender/blenlib/BLI_vector.hh b/source/blender/blenlib/BLI_vector.hh index 66de8d2fbd1..11bb00c3f8d 100644 --- a/source/blender/blenlib/BLI_vector.hh +++ b/source/blender/blenlib/BLI_vector.hh @@ -702,6 +702,14 @@ class Vector { return this->first_index_of_try(value) != -1; } + /** + * Copies the given value to every element in the vector. + */ + void fill(const T &value) const + { + initialized_fill_n(begin_, this->size(), value); + } + /** * Get access to the underlying array. */ -- cgit v1.2.3