@specsoftdev live:.cid.8e17e9b93cabb607 specsoftdev@gmail.com
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