OpenMS  2.6.0
Public Member Functions | Protected Attributes | Related Functions | List of all members
LexicographicComparator< Cmp1, Cmp2 > Struct Template Reference

A wrapper class that combines two comparators lexicographically. Normally you should use the make-function lexicographicComparator() because then you do not need to specify the template arguments. More...

#include <OpenMS/KERNEL/ComparatorUtils.h>

Inheritance diagram for LexicographicComparator< Cmp1, Cmp2 >:
[legend]
Collaboration diagram for LexicographicComparator< Cmp1, Cmp2 >:
[legend]

Public Member Functions

 LexicographicComparator (Cmp1 const &cmp1=Cmp1(), Cmp2 const &cmp2=Cmp2())
 
template<typename T1 , typename T2 >
bool operator() (T1 left, T2 right) const
 

Protected Attributes

const Cmp1 & cmp1_
 
const Cmp2 & cmp2_
 

Related Functions

(Note that these are not member functions.)

template<typename Cmp1 , typename Cmp2 >
LexicographicComparator< Cmp1, Cmp2 > lexicographicComparator (Cmp1 const &cmp1, Cmp2 const &cmp2)
 Make-function to create a LexicographicComparator from two other comparators without the need to specify the template arguments. More...
 

Detailed Description

template<typename Cmp1, typename Cmp2>
struct OpenMS::LexicographicComparator< Cmp1, Cmp2 >

A wrapper class that combines two comparators lexicographically. Normally you should use the make-function lexicographicComparator() because then you do not need to specify the template arguments.

Both comparators should of course have the same argument types. The result_type is bool, that is, we perform a two-way comparison like less<> and its relatives.

Constructor & Destructor Documentation

◆ LexicographicComparator()

LexicographicComparator ( Cmp1 const &  cmp1 = Cmp1(),
Cmp2 const &  cmp2 = Cmp2() 
)
inline

Member Function Documentation

◆ operator()()

bool operator() ( T1  left,
T2  right 
) const
inline

Friends And Related Function Documentation

◆ lexicographicComparator()

LexicographicComparator< Cmp1, Cmp2 > lexicographicComparator ( Cmp1 const &  cmp1,
Cmp2 const &  cmp2 
)
related

Make-function to create a LexicographicComparator from two other comparators without the need to specify the template arguments.

The usage is similar to pointerComparator() or reverseComparator(), which see.

Member Data Documentation

◆ cmp1_

const Cmp1& cmp1_
protected

◆ cmp2_

const Cmp2& cmp2_
protected