reverse_copy function template — Copies a range in reverse order
template<typename BidiIter, typename OutIter>
OutIter reverse_copy(BidiIter first, BidiIter last, OutIter result);
The reverse_copy
function
template copies items in reverse order from the range [first
, last
) to the range that starts at result
. In other words, *(last
- 1)
is first copied to *result
, then *(last
- 2)
is copied to *(result
+
1)
,
and so on. The return value is an iterator that points to one past
the end of the result range. The source and result ranges must not
overlap. Figure 13-15
shows an example of reversing a range.