Features of the standard algorithms
To get a better understanding of the standard algorithms, it's good to know a bit about the features and common patterns used by all algorithms in the
<algorithm> header. As already stated, the algorithms under the
std::ranges namespaces have a lot in common. We will start here with the general principles that are true for both the
std algorithms and the constrained algorithms under
std::range. Then, in the next section, we will move on to discuss the features that are specific to the constrained algorithms found under
Algorithms do not change the size of the container
<algorithm> can only modify the elements in a specified range; elements are never added or deleted from the underlying container. Therefore, these functions never alter the size of the container that they operate on.
std::unique() do not actually remove elements from a container (despite...