36 #ifndef OPENMS_KERNEL_COMPARATORUTILS_H 37 #define OPENMS_KERNEL_COMPARATORUTILS_H 174 public std::binary_function<typename Cmp::first_argument_type *, typename Cmp::second_argument_type *, typename Cmp::result_type>
183 template <
typename T1,
typename T2>
184 typename Cmp::result_type
187 return cmp_(*left, *right);
225 std::binary_function<typename Cmp::second_argument_type, typename Cmp::first_argument_type, typename Cmp::result_type>
234 template <
typename T1,
typename T2>
235 typename Cmp::result_type
238 return cmp_(right, left);
275 template <
typename Cmp1,
typename Cmp2>
277 std::binary_function<typename Cmp1::first_argument_type, typename Cmp1::second_argument_type, bool>
280 cmp1_(cmp1), cmp2_(cmp2) {}
282 template <
typename T1,
typename T2>
286 if (cmp1_(left, right))
292 if (cmp1_(right, left))
298 return cmp2_(left, right);
316 template <
typename Cmp1,
typename Cmp2>
325 template <
typename PairType>
327 std::binary_function<PairType, PairType, bool>
329 bool operator()(
const PairType & left,
const PairType & right)
const 331 return left.first < right.first;
339 template <
typename PairType>
341 std::binary_function<PairType, PairType, bool>
343 bool operator()(
const PairType & left,
const PairType & right)
const 345 return left.second < right.second;
353 template <
typename PairType>
355 std::binary_function<PairType, PairType, bool>
357 bool operator()(
const PairType & left,
const PairType & right)
const 359 return left.first > right.first;
367 template <
typename PairType>
369 std::binary_function<PairType, PairType, bool>
371 bool operator()(
const PairType & left,
const PairType & right)
const 373 return left.second > right.second;
381 template <
typename PairType>
383 std::binary_function<PairType, PairType, bool>
385 bool operator()(
const PairType & left,
const PairType & right)
const 387 return left.first == right.first;
395 template <
typename PairType>
397 std::binary_function<PairType, PairType, bool>
399 bool operator()(
const PairType & left,
const PairType & right)
const 401 return left.second == right.second;
413 template <
typename CompareType>
415 public std::binary_function<CompareType, CompareType, bool>
425 CompareType diff = fabs(i - j);
426 return diff <= tolerance;
432 #endif // OPENMS_KERNEL_COMPARATORUTILS_H EqualInTolerance(CompareType &c)
Definition: ComparatorUtils.h:419
bool operator()(const PairType &left, const PairType &right) const
Definition: ComparatorUtils.h:385
LexicographicComparator(Cmp1 const &cmp1=Cmp1(), Cmp2 const &cmp2=Cmp2())
Definition: ComparatorUtils.h:279
A wrapper class that combines two comparators lexicographically. Normally you should use the make-fun...
Definition: ComparatorUtils.h:276
Cmp::result_type operator()(T1 left, T2 right) const
Definition: ComparatorUtils.h:236
bool operator()(const PairType &left, const PairType &right) const
Definition: ComparatorUtils.h:343
Struct for comparison of std::pair using second ONLY e.g. for use with std::sort. ...
Definition: ComparatorUtils.h:396
Cmp2 const & cmp2_
Definition: ComparatorUtils.h:305
ReverseComparator< Cmp > reverseComparator(Cmp const &cmp)
Make-function to create a ReverseComparator from another comparator without the need to specify the t...
Definition: ComparatorUtils.h:261
Class for comparison of std::pair using first ONLY e.g. for use with std::sort.
Definition: ComparatorUtils.h:354
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
PointerComparator(PointerComparator const &pCmp)
Definition: ComparatorUtils.h:176
CompareType & tolerance
Definition: ComparatorUtils.h:417
Class for comparison of std::pair using second ONLY e.g. for use with std::sort.
Definition: ComparatorUtils.h:368
LexicographicComparator< Cmp1, Cmp2 > lexicographicComparator(Cmp1 const &cmp1, Cmp2 const &cmp2)
Make-function to create a LexicographicComparator from two other comparators without the need to spec...
Definition: ComparatorUtils.h:317
Struct for binary predicate to consider equality with a certain tolerance.
Definition: ComparatorUtils.h:414
bool operator()(const PairType &left, const PairType &right) const
Definition: ComparatorUtils.h:329
Class for comparison of std::pair using first ONLY e.g. for use with std::sort.
Definition: ComparatorUtils.h:382
bool operator()(const PairType &left, const PairType &right) const
Definition: ComparatorUtils.h:399
Cmp1 const & cmp1_
Definition: ComparatorUtils.h:304
bool operator()(CompareType i, CompareType j)
Definition: ComparatorUtils.h:423
ReverseComparator(Cmp const &cmp=Cmp())
Definition: ComparatorUtils.h:231
Cmp const & cmp_
Definition: ComparatorUtils.h:191
Class for comparison of std::pair using second ONLY e.g. for use with std::sort.
Definition: ComparatorUtils.h:340
Wrapper that takes a comparator for `something' and makes a comparator for pointers to `something' ou...
Definition: ComparatorUtils.h:173
ReverseComparator(ReverseComparator const &cmp)
Definition: ComparatorUtils.h:228
bool operator()(const PairType &left, const PairType &right) const
Definition: ComparatorUtils.h:371
PointerComparator(Cmp const &cmp=Cmp())
Definition: ComparatorUtils.h:179
bool operator()(T1 left, T2 right) const
Definition: ComparatorUtils.h:284
Wrapper that reverses (exchanges) the two arguments of a comparator. Normally you should use the make...
Definition: ComparatorUtils.h:224
Class for comparison of std::pair using first ONLY e.g. for use with std::sort.
Definition: ComparatorUtils.h:326
bool operator()(const PairType &left, const PairType &right) const
Definition: ComparatorUtils.h:357
Cmp const & cmp_
Definition: ComparatorUtils.h:242
PointerComparator< Cmp > pointerComparator(Cmp const &cmp)
Make-function to create a PointerComparator from another comparator without the need to specify the t...
Definition: ComparatorUtils.h:210
Cmp::result_type operator()(T1 left, T2 right) const
Definition: ComparatorUtils.h:185