Process data with C++ standard algorithms and lambdas
8 steps · about 2 h 25 min · Beginner
- Survey the algorithms library (article, cppreference, 15 min)
Shows the toolbox so you reach for it before writing a loop.
- Write lambda expressions and captures (article, cppreference, 30 min)
Needed to pass behaviour into every algorithm.
- Sort with a custom comparator (article, cppreference, 15 min)
First algorithm most programmers need.
- Search with find and find_if (article, cppreference, 15 min)
Replaces linear search loops.
- Map values with transform (article, cppreference, 15 min)
The C++ way to apply a function to a range.
- Reduce with accumulate (article, cppreference, 15 min)
Sums and folds a range.
- Erase elements with the erase-remove idiom (article, cppreference, 20 min)
Avoids a classic bug when deleting from vectors.
- Preview ranges in modern C++ (article, cppreference, 20 min)
Shows composable pipelines that supersede iterator pairs.