STL Algorithms – How to Use Them and How to Write Your Own
summary
Explains how to implement and use STL-style algorithms with concrete code: builds adjacent_pair and for_all_pairs (one O(n), one O(n^2)), implements copy_while that returns a std::pair of input and output iterators, and a splitter using std::find and functors; shows making the adjacent-pair version work with input iterators by copying a saved element and by querying iterator properties via iterator_traits and tag dispatching; discusses iterator category tradeoffs, iterator wrappers like std::ref/back_inserter, and C++17 parallel/ranges directions.
AI-written summary · about
chapters (10)
- 0:00STL algorithms intro
- 1:49Standard library overview
- 12:23STL vs hand-written loops
- 16:05Simple STL algorithms
- 24:49Custom adjacent pair
- 36:40Iterator categories design
- 52:52Tips for reusable algorithms
- 1:02:26Iterator constraints handling
- 1:12:47Ranges and algorithm future
- 1:24:49Q&A
related talks
01h 01mAlgorithm Intuition (part 1 of 2)
01h 01mAlgorithm Intuition (part 2 of 2)
56mBeginners Guide to C++'s Best Kept Secret -- std::algorithm
01h 23mAlex Stepanov, Generic Programming in Cpp, and the STL
57mSome Things C++ Does Right
57mRange Algorithms, Views and Actions: A Comprehensive Guide
01h 35mThe Twin Algorithms
01h 25mNew Algorithms in C++23
