libzypp
17.10.2

Classes  
struct  zypp::Compare< Tp > 
General compare functor returning 1, 0, 1 . More...  
struct  zypp::CompareBy< Tp, TCompare > 
Functor to compare two elements by Rel based on a general TCompare functor. More...  
struct  zypp::CompareByEQ< Tp, TCompare > 
struct  zypp::CompareByNE< Tp, TCompare > 
struct  zypp::CompareByLT< Tp, TCompare > 
struct  zypp::CompareByLE< Tp, TCompare > 
struct  zypp::CompareByGT< Tp, TCompare > 
struct  zypp::CompareByGE< Tp, TCompare > 
struct  zypp::CompareByANY< Tp, TCompare > 
struct  zypp::CompareByNONE< Tp, TCompare > 
Functions  
template<class Tp , class TCompare >  
bool  zypp::compareByRel (Rel op, const Tp &lhs, const Tp &rhs, TCompare compare) 
Comparison of two elements using relational operator op. More...  
template<class Tp >  
bool  zypp::compareByRel (Rel op, const Tp &lhs, const Tp &rhs) 
compareByRel convenience using Compare<Tp> as general compare functor. More...  
Take a class like zypp::Edition. Editions are comaprable. You can compare them lexicographical, or according to their version and release values, or match them (i.e. taking empty version or release values as wildcard).
No matter which way is appropriate within a certain context. You need functions to compare, and may want to use classes like zypp::Range, based on the desired comparison.
All the class has to do, is providing a general comparison method (preferably static)
Compare<Tp>
provides a functor wrapping compare
. In case the general comparison method is named differently, the class, or you, have to provide an approriate functor.
compareByRel
then compares two elements using a certain operator and general comparison method.
Furthermore a bunch of functors using a certain opertator is defined. All templated by type and general comparison method (defaults to Compare<Tp>).
Classes like zypp:Range are templated by by type and general comparison method as well. Thus you may use Edition ranges based on Edition::Compare, as well as ranges based on Edition::Match (Edition provides these two functors).
Again: Everything a class has to provide is the general comparison method. Comparison functors and ranges are then immediately available.

inline 
Comparison of two elements using relational operator op.
Expects TCompare to be a binary operator returning 1, 0, 1
if the elemants compare <,==,>
.
true
. false
. Definition at line 108 of file RelCompare.h.
compareByRel convenience using Compare<Tp> as general compare functor.
Definition at line 144 of file RelCompare.h.