A more compact version
template<class T>
void reverse(T begin, T end)
{
while (begin != end)
if (begin != --end)
swap(*begin++, *end);
}
This is another standard library function
Previous slide
Next slide
Back to first slide
View graphic version