BLI: add Vector/Array.fill methods
This commit is contained in:
@@ -268,6 +268,14 @@ class Array {
|
||||
return size_ == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user