Beginners Guide to C++'s Best Kept Secret -- std::algorithm
summary
Begins from raw for loops and shows concrete rewrites that use iterators, range for, and std::algorithm to compute the average of the top three positive integers in a vector. Uses copy_if to filter, then sort + accumulate or alternately partition and nth_element to avoid full sorts, and mentions C++20 ranges and parallel policies like std::execution::par. Claims over 100 algorithms exist (≈105), demonstrates fewer lines, fewer bugs, and practical performance/maintainability tradeoffs.
AI-written summary · about
chapters (25)
- 0:00Start
- 0:32Goals
- 3:51Data Structures
- 4:35Introducing Standard Vector
- 6:56Optimization
- 13:42Iterators
- 15:29Interval Notation
- 22:14Range Based for Loops
- 24:08Standard Algorithm
- 24:55The Software Development Life Cycle
- 29:12Sorting Approach
- 34:02Copyif
- 35:46Back Inserter
- 36:53Accumulate
- 40:20Sorting Operations
- 41:03Partitioning
- 41:18Stable Partition
- 42:44Median Filters
- 43:30Numeric Operations
- 44:07Random Generator
- 44:26Standard Ranges
- 45:57Pipe Operator
- 47:19Performance
- 47:51Overloads
- 54:24Further Resources and Training Materials
related talks
01h 01mAlgorithm Intuition (part 2 of 2)
01h 01mAlgorithm Intuition (part 1 of 2)
46mC++ Fundamentals - Algorithms
01h 23mAlex Stepanov, Generic Programming in Cpp, and the STL
57mRange Algorithms, Views and Actions: A Comprehensive Guide
01h 00mOLD VERSION: The Fine Details Behind C++ Containers And Algorithms
01h 31mSTL Algorithms – How to Use Them and How to Write Your Own
57mSome Things C++ Does Right
