© Ray Lischner 2020
R. LischnerExploring C++20https://doi.org/10.1007/978-1-4842-5961-0_10

10. Algorithms and Ranges

Ray Lischner1 
Ellicott City, MD, USA

The previous Exploration introduced vectors and ranges using std::ranges::sort to sort a vector of integers. This Exploration examines ranges in more depth and introduces more generic algorithms, which perform useful operations on ranges of objects.


The std::ranges::sort function is an example of a generic algorithm, so named because these functions implement common algorithms and operate generically. That is, they work for just about anything you can express as a sequential range of values. Most of the standard algorithms are declared in the <algorithm> header, although the <numeric> ...

Get Exploring C++20: The Programmer's Introduction to C++ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.