STL Algorithms - why you should use them, and how to write your own
summary
Explains why std algorithms are reliable, tested and efficient and shows how to build reusable ones: implements adjacent_pair and an O(n^2) all_pairs, a copy_while that returns the advanced input iterator, and a split that uses find; demonstrates using iterator categories with iterator_traits and tag dispatch to provide different implementations for input vs forward iterators; proves nontrivial ideas (gather can be done with two stable_partitions), and emphasizes handling degenerate cases and measuring complexity.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 1:40What are STL algorithms
- 3:40Advantages of using algorithms
- 8:23Algorithm design principles
- 13:16Writing custom algorithms
- 19:43Abstraction and iteration
- 23:48Custom copy variants
- 30:16Design challenges and tradeoffs
- 37:32General guidance and history
- 46:40Iterator categories
- 52:52Tag dispatch and Q&A
related talks
01h 02m“STL Algorithms in Action "
54m105 STL Algorithms in Less Than an Hour
01h 02mWriting Standard Library Compliant Data Structures and Algorithms
37mEnhancing STL containers
32mC++ Standard Library "Little Things”
01h 03mConstructing Generic Algorithms: Principles and Practice
01h 13m"Mostly Invalid": flat_map, Exception Guarantees, and the STL
01h 07mDesign Patterns in Modern C++
