Lecture overview -- Keyboard shortcut: 'u'  Previous page: An example of for-each and function objects -- Keyboard shortcut: 'p'  Next page: Adapter examples -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 5 - Page 38 : 39
Notes about C++
Templates and The Standard Library
Use of function objects in STL

In a context where lambda expressions are not yet used, and

operators are not functions

Binders, Adapters and Negaters

  • The C++ Programming Language: Page 518
 

  • Wrapping operator predicates

    • Predicates such as == and <

    • Available as for instance equal_to, less, and greater - see §18.4.2.1

  • Wrapping arithmetic operators

    • Operators such as + and -

    • Available as plus and minus, see §18.4.3

  • Binding one argument of a two argument function

    • Currying

  • Allowing a member function to be used as a function

    • mem_fun, applied on a member pointer, servers as a function that can called on an object

  • Negating a predicate