Lecture overview -- Keyboard shortcut: 'u'  Previous page: Using the sort algorithm -- Keyboard shortcut: 'p'  Next page: Use of function objects in STL -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    Templates and The Standard Library - slide 37 : 39

An example of for-each and function objects

An sample use of for-each() to find out if a list is sorted

Initial discussions of possible solutions to this simple problem

for-each-1.cpp
A possible use of for-each to solve this problem.
adjacent-1.cpp
Following the advice: Solve the problem with a more appropriate algorithm.
greater-and-binary-function.cpp
The type greater and its base class.