Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Protected Attributes | Related Functions | List of all members
PointerComparator< Cmp > Struct Template Reference

Wrapper that takes a comparator for `something' and makes a comparator for pointers to `something' out of it. Normally you should use the make-function pointerComparator() because then you do not need to specify the template arguments. More...

#include <OpenMS/KERNEL/ComparatorUtils.h>

Inheritance diagram for PointerComparator< Cmp >:

Public Member Functions

 PointerComparator (PointerComparator const &pCmp)
 
 PointerComparator (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 >
PointerComparator< Cmp > pointerComparator (Cmp const &cmp)
 Make-function to create a PointerComparator from another comparator without the need to specify the template arguments. More...
 

Detailed Description

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

Wrapper that takes a comparator for `something' and makes a comparator for pointers to `something' out of it. Normally you should use the make-function pointerComparator() because then you do not need to specify the template arguments.

This works by dereferencing the arguments (unary operator*) before comparing them.
E.g. you can use

PointerComparator<Peak1D::IntensityLess> to compare Peak1D* in the same way as Peak1D::IntensityLess works for Peak1D .

Constructor & Destructor Documentation

◆ PointerComparator() [1/2]

PointerComparator ( PointerComparator< Cmp > const &  pCmp)
inline

◆ PointerComparator() [2/2]

PointerComparator ( Cmp const &  cmp = Cmp())
inline

Member Function Documentation

◆ operator()()

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

Friends And Related Function Documentation

◆ pointerComparator()

PointerComparator< Cmp > pointerComparator ( Cmp const &  cmp)
related

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

For example,

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

Member Data Documentation

◆ cmp_

Cmp const& cmp_
protected

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:12 using doxygen 1.8.13