English
Topic 14. Iterators, algorithms, ranges, and lambda expressions
Goal: learn to build algorithms with explicit preconditions, safe captures, and a controlled lifetime of ranges.
Lecture contents
- Iterators and invalidation — A position instead of a tie to the container · Categories and algorithm requirements · Invalidation: A structural change changes positions · remove, erase, and output iterators
- Lambda expressions and functors — A lambda as an object with state · Functors, invoke, and algorithm predicates
- Standard library algorithms — Searching, filtering, sorting, and permuting · Numeric algorithms and associativity
- Ranges and views — Ranges algorithms and projections · Views, laziness, and materialization · Lifetime and a custom range
- Case studies and common mistakes — A step-by-step pipeline walkthrough · Contracts of numeric algorithms on concrete values · Checking lifetime before returning a result · A test matrix for an algorithmic solution · Choosing an algorithm by the required result