| Lecture 6 - Slide 24 : 40|
Use of function objects in STL
Operators are not functions - operators need some wrapping to be applicable as function parameters to algorithms.
Binders, Adapters and Negaters.
- Wrapping operator predicates
- Predicates such as ==, < and >
- Available as equal_to, less, and greater - see §33.4 (4ed)
- Wrapping arithmetic operators
- Operators such as + and -
- Available as plus and minus, see §33.4 (4ed)
- Binding one argument of a two argument function
- Currying as of functional programming
- Allowing a member function to be used as a function
- mem_fun, applied on a member pointer, serves as a function that can called on an object
- Negating a predicate