programminga general overview /generic findmaxwith function objectversion # /preconditiona size template const object findmaxconst vector arrcomparator cmp int maxindex forint arr size)++ ifcmp islessthanarrmaxindex ]arri maxindex ireturn arrmaxindex ]class caseinsensitivecompare publicbool islessthanconst string lhsconst string rhs const return strcasecmplhs c_str)rhs c_str }int mainvector arr "zebra""alligator""crocodile}cout <findmaxarrcaseinsensitivecompare<endlreturn figure simplest idea of using function object as second parameter to findmaxoutput is zebra cmp operator()( ,ycan be shortened to cmp( , (in other wordsit looks like function calland consequently operator(is known as the function call operatoras resultthe name of the parameter can be changed to the more meaningful islessthanand the call is islessthan( ,ythirdwe can provide version of findmax that works without function object the implementation uses the standard library function object template less (defined in header file functionalto generate function object that imposes the normal default ordering figure shows the implementation using the more typicalsomewhat crypticc+idioms in we will give an example of class that needs to order the items it stores we will write most of the code using comparable and show the adjustments needed to use the function objects elsewhere in the bookwe will avoid the detail of function objects to keep the code as simple as possibleknowing that it is not difficult to add function objects later