std::move_backward
Актуально для C++23.
#include <algorithm>
Актуально на 2024-10-15.
Define overload #1
template<class BiIterator1, class BiIterator2> constexpr BiIterator2 move_backward(BiIterator1 first, BiIterator1 last, BiIterator2 result);
Перемещает элементы начиная с конца диапазона [first, last] в result, декрементируя result.
Вернёт итератор на начало диапазона result.
Example, possible implementation
Examples
Example 1:
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
template<class T>
auto print(const std::vector<T>& v)
{
for (auto c : v)
std::cout << c << ' ';
std::cout << std::endl;
}
int main()
{
std::vector<std::string> in{"0","1","2","3","4","5","6","7","8","9"};
std::vector<std::string> out(in.size());
std::move_backward(std::begin(in), std::end(in), std::end(out));
std::cout << "in: " ;
print(in);
std::cout << "out: " ;
print(out);
}
in: out: 0 1 2 3 4 5 6 7 8 9
Changelog
See also
TODO
This page was last modified on 2024-10-15