Leverage Existing Algorithms: Gather
Learn to give leverage to existing algorithms with gather.
We'll cover the following
gather()
is an example of an algorithm that leverages existing algorithms. The gather()
algorithm takes a pair of container iterators and moves the elements that satisfy a predicate toward a pivot position within the sequence, returning a pair
of iterators that contains the elements that satisfy the predicate.
For example, we could use a gather
algorithm to sort all the even numbers to the mid-point of a vector
:
Get hands-on with 1400+ tech skills courses.