The Function Object Pattern
The Function Object pattern can be regarded as a variation to the Command pattern that takes parameters and returns a result. The pattern describes how to build encapsulated components for behavior parameterization, function reuse, calculation on demand, representing ``business-transactions'', and first-class behavior, e.g., protocol-, undo-, and persistence mechanisms. In contrast to Command, Function Object establishes a useful collaboration with iterators. We show in particular how to use generic function objects with iterators in order to allow multi-dispatching operations on heterogeneous data structures.