STL: Algorithms

Prefer algorithms to loops.

Bjarne Stroustrup, [Stroustrup00] §18.12

Algorithms are loops—only better. Algorithms are the “patterns” of loops, adding far more semantic content and richness than a naked for would do alone. Of course, the moment you start using algorithms you’ll also start using function objects and predicates; write them correctly, and use them well.

Our vote for the most valuable Item in this section goes to Item 83: Use a checked STL implementation.

Get C++ Coding Standards: 101 Rules, Guidelines, and Best Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.