diff options
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_array.hh | 8 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_vector.hh | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_array.hh b/source/blender/blenlib/BLI_array.hh index c30893f1337..871038d7d85 100644 --- a/source/blender/blenlib/BLI_array.hh +++ b/source/blender/blenlib/BLI_array.hh @@ -269,6 +269,14 @@ class Array { } /** + * Copies the given value to every element in the array. + */ + void fill(const T &value) const + { + initialized_fill_n(data_, size_, value); + } + + /** * Get a pointer to the beginning of the array. */ const T *data() const 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 @@ -703,6 +703,14 @@ class Vector { } /** + * 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. */ T *data() |