public member function
<array>
std::array::fill
void fill (const value_type& val);
Fill array with value
Parameters
- val
- Value to fill the array with.
Member type value_type is the type of the elements in the container, defined in array as an alias of its first template parameter (T).
Return value
noneExample
|
|
Output:
myarray contains: 5 5 5 5 5 5
Complexity
Linear: Performs as many assignment operations as the size of the array object.Iterator validity
No changes.Data races
All contained elements are modified.Exception safety
Basic guarantee: if an exception is thrown, the container is in a valid state.It throws if the assignment of any element throws.
See also
- array::data
- Get pointer to data (public member function)
- fill
- Fill range with value (function template)
- fill_n
- Fill sequence with value (function template)