Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Protected Attributes | Related Functions

ReverseComparator< Cmp > Struct Template Reference

Wrapper that reverses (exchanges) the two arguments of a comparator. Normally you should use the make-function reverseComparator() because then you do not need to specify the template arguments. More...

#include <OpenMS/KERNEL/ComparatorUtils.h>

Inheritance diagram for ReverseComparator< Cmp >:
binary_function

List of all members.

Public Member Functions

 ReverseComparator (ReverseComparator const &cmp)
 ReverseComparator (Cmp const &cmp=Cmp())
template<typename T1 , typename T2 >
Cmp::result_type operator() (T1 left, T2 right) const

Protected Attributes

Cmp const & cmp_

Related Functions

(Note that these are not member functions.)



template<class Cmp >
ReverseComparator< Cmp > reverseComparator (Cmp const &cmp)
 Make-function to create a ReverseComparator from another comparator without the need to specify the template arguments.

Detailed Description

template<class Cmp>
struct OpenMS::ReverseComparator< Cmp >

Wrapper that reverses (exchanges) the two arguments of a comparator. Normally you should use the make-function reverseComparator() because then you do not need to specify the template arguments.

For example, ReverseComparator<less<T> > works like greater<T> .


Constructor & Destructor Documentation

ReverseComparator ( ReverseComparator< Cmp > const &  cmp  )  [inline]
ReverseComparator ( Cmp const &  cmp = Cmp()  )  [inline]

Member Function Documentation

Cmp::result_type operator() ( T1  left,
T2  right 
) const [inline]

Friends And Related Function Documentation

ReverseComparator< Cmp > reverseComparator ( Cmp const &  cmp  )  [related]

Make-function to create a ReverseComparator from another comparator without the need to specify the template arguments.

For example,

    int i = 88, j = 99;
    if ( reverseComparator(std::less<int>())(j,i) )
    {
    // yes, 99 > 88.
    }
    

Member Data Documentation

Cmp const& cmp_ [protected]

OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:54 using doxygen 1.7.1