Skip to the content of the web site.

Project W.3: Fill

This sets all the entries in the array to the given entry. The default value of fill parameter should be zero.

Integer implementation

void fill( int array[], std::size_t capacity, int value = 0 );

Templated implementation

For templated implementations, you could use 0 as the default value, but it is better to use the default value of the templated type: T{}.

template <typename T>
void fill( T array[], std::size_t capacity, T value = T{} );