CSE 332: C++ STL functio n obje cts Overview of STL Function Objects Function Object (also known as a Functor) ± STL Function Objects supportfunction call syntax E.g., a class that declare s and de fi nes operator() E. g., by b eing a f unction pointer ± GoF Command pattern maybe applied to classes and structs (user-defined types) Enca ps ul ate a f unct io n ca ll as an ob ject Some or all of th ese can be member vari ab les ± Target ob ject reference, f unction to invoke, argument s Generic programming allows diverse t ypes ± A functi on poin ter (e xa mp le f rom Li ppma n, L aJoi e, Mo o) bool (*pf) (const string &, const & string) // function pointer bool *pf (const string &, const & string) // function named pf ± An instance of a cl ass providing operator()