std::fill
ΠΠΊΡΡΠ°Π»ΡΠ½ΠΎ Π΄Π»Ρ C++23.
#include <algorithm>
ΠΠΊΡΡΠ°Π»ΡΠ½ΠΎ Π½Π° 2024-03-20.
Define overload #1
template<class ForwardIter, class T> constexpr void fill(ForwardIter first, ForwardIter last, const T& value);
ΠΡΠΈΡΠ²Π°ΠΈΠ²Π°Π΅Ρ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ "value" ΠΊΠ°ΠΆΠ΄ΠΎΠΌΡ ΡΠ»Π΅ΠΌΠ΅Π½ΡΡ Π² Π΄ΠΈΠ°ΠΏΠ°Π·ΠΎΠ½Π΅ [first, last].
Example, possible implementation
Define overload #2
template<class ExecutionPolicy, class ForwardIter, class T>
void fill(ExecutionPolicy&& exec, ForwardIter first,
ForwardIter last, const T& value);
TODO
Example, possible implementation
Examples
Example 1:
#include <iostream>
#include <algorithm>
#include <vector>
int main()
{
std::vector<int> v(10);
std::fill(std::begin(v), std::end(v), 42);
for (auto it : v) {
std::cout << it << std::endl;
}
return 0;
}
42 42 42 42 42 42 42 42 42 42
Changelog
See also
TODO
This page was last modified on 2024-03-20