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