April 2024
Beginner
656 pages
23h 19m
English
In theory, practice is simple.
– Trygve Reenskaug
This chapter completes our presentation of the fundamental ideas of the STL and our survey of the facilities it offers. Here, we focus on algorithms. Our primary aim is to introduce about a dozen of the most useful ones, which will save you days, if not months, of work. Each is presented with examples of its uses and of programming techniques that it supports. Our second aim here is to give you sufficient tools to write your own – elegant and efficient – algorithms if and when you need more than what the standard library and other available libraries have to offer.
§21.1 Standard-library algorithms
The simplest algorithm: find(); Some generic uses; Generalizing search: find_if() ...