| Lecture 6 - Slide 23 : 40|
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
A possible use of for-each to solve this problem.
- Use of objects as functions via an overload of the application operator
- A function surrounded by private, mutable state
- Use of the returned value from for-each
Following the advice: Solve the problem with a more appropriate algorithm.
- greater is a wrapper around the > operator, §33.4 (4ed)
Possible definitions of the type greater and its base class.