January 2018
Intermediate to advanced
374 pages
9h 53m
English
Let's say we need a function that moves the first n elements from the front of a container to the back, like this:

Approach 1 – Use a traditional for-loop:
A very naive approach would be to copy the first n elements to the back while iterating over them and then erasing the first n elements:

Here's the corresponding implementation:
template <typename Container> ...