First page Back Continue Last page Graphics
More complicated, but with three advantages:
More complicated, but with three advantages:
1. A function object might be smarter because it may have a state. In fact, you can have two instances of the same function, represented by a function object, which may have different states at the same time. This is not possible for ordinary functions.
2. Each function object has its own type. Thus you can pass the type of a function object to a template to specify a certain behaviour, and you have the advantage that container types with different function objects differ.