Daily bit(e) of C++ | std::reverse
Daily bit(e) of C++ #250, The algorithm for reversing elements in a bidirectional range.
If we want to iterate over the elements of a bidirectional range in reverse order, we do not have to mutate it.
However, if we want to mutate the range, we can use the std::reverse algorithm.
Note that std::list and std::forward_list provide a reverse method that reorders the nodes (instead of reversing the order of the values).