#include <algorithm>
void fill_n (Out first, Size n, T wert) void fill_n (Exec pol, Out first, Size n, T wert) Out ranges::fill_n (Out first, Size n, T wert)
Füllt in den bei first beginnenden Bereich n mal den wert.
first | Anfang des Bereiches |
n | Anzahl der zu setzenden Elemente |
wert | Füllwert |
pol | parallele Ausführungsart |
Rückgabewert: keiner bzw. first+n.
#include <algorithm> #include <iostream> int main() { int arr[3]; std::fill_n(arr, 3, 6); std::cout << arr[0] << arr[1] << arr[2] << '\n'; }