MaxCmp is a helper class to be used in a loop where one would like to keep track of the largest value so far of a certain expression. More...
#include <MaxCmp.h>
Public Member Functions  
MaxCmp ()  
The default constructor.  
MaxCmp (const T &t, Indx in=Indx())  
Constructor specifying an initial maximum value, t.  
bool  operator() (const T &t, Indx i=Indx()) 
If t is the largest value seen so far return true. More...  
operator const T & () const  
Return the largest value so far.  
const T &  value () const 
Return the largest value so far.  
Indx  index () const 
Return the index of the largest object seen so far.  
bool  operator! () const 
Return true if no index has been chosen.  
Private Attributes  
bool  init 
True if a first value has been given;.  
T  max 
The largest value seen so far.  
Indx  indx 
The index for the largest value seen so far.  
Cmp  cmp 
The comparison object to be used.  
MaxCmp is a helper class to be used in a loop where one would like to keep track of the largest value so far of a certain expression.
The class simply checks if the given value to the operator() is the largest so far (in which case true is returned, and the value is saved together with the optional index argument. The Cmp template argument is by default greater<T>, but can be set to any comparison class to change the meaning of maximum: MaxCmp<double, int, less<double> > will keep track of the smallest value.

inline 