16.1 Introduction

This chapter discusses the Standard Library’s algorithms, focusing on common container manipulations such as searching, sorting and comparing elements or entire containers. The Standard Library provides over 90 algorithms—many were added in C++11 and some are new in C++14. For the complete list, see


http://en.cppreference.com/w/cpp/algorithm
http://en.cppreference.com/w/cpp/numeric

As you’ll see, various algorithms can receive a function pointer as an argument—recall that a function’s name is implictly convertible to a pointer to that function’s code. Such algorithms use the pointer to call the function, typically with one or two container elements as arguments. For most of the examples in this chapter, rather than ...

Get C++ How to Program, 10/e 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.