| OpenMS 2.5.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 >:

## 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

Cmp1 const & | cmp1_
Cmp2 const & | 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

References LexicographicComparator< Cmp1, Cmp2 >::cmp1_, and LexicographicComparator< Cmp1, Cmp2 >::cmp2_.

## 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_

Cmp1 const& cmp1_

protected

Referenced by LexicographicComparator< Cmp1, Cmp2 >::operator()().

## ◆ cmp2_

Cmp2 const& cmp2_

protected

Referenced by LexicographicComparator< Cmp1, Cmp2 >::operator()().