make_reverse_iterator
is a convenience function template that constructs a std::reverse_iterator for the given iterator i (which must be a LegacyBidirectionalIterator) with the type deduced from the type of the argument.
std::reverse_iterator<Iter>(i)
[edit] Notes [edit] Example#include <algorithm> #include <iostream> #include <iterator> #include <vector> int main() { std::vector<int> v{1, 3, 10, 8, 22}; std::sort(v.begin(), v.end()); std::copy(v.begin(), v.end(), std::ostream_iterator<int>(std::cout, ", ")); std::cout << '\n'; std::copy(std::make_reverse_iterator(v.end()), std::make_reverse_iterator(v.begin()), std::ostream_iterator<int>(std::cout, ", ")); std::cout << '\n'; }
Output:
1, 3, 8, 10, 22, 22, 10, 8, 3, 1,[edit] See also iterator adaptor for reverse-order traversal
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4