MCPcopy Create free account
hub / github.com/HelenOS/helenos / reverse

Function reverse

uspace/lib/cpp/include/__bits/algorithm.hpp:632–641  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

630
631 template<class BidirectionalIterator>
632 void reverse(BidirectionalIterator first, BidirectionalIterator last)
633 {
634 if (first == last)
635 return;
636 auto mid_count = (last - first) / 2;
637
638 --last;
639 for (decltype(mid_count) i = 0; i < mid_count; ++i)
640 iter_swap(first++, last--);
641 }
642
643 template<class BidirectionalIterator, class OutputIterator>
644 OutputIterator reverse_copy(BidirectionalIterator first,

Callers 1

runMethod · 0.85

Calls 1

iter_swapFunction · 0.85

Tested by 1

runMethod · 0.68