* in the example.<BR>
* If Edition is used as key in a std::container, per default
* <em>plain string comparison</em> is used. If you want to compare by
- * version, let the container use Edition::ComareLess to compare.
+ * version, let the container use \ref CompareByLT<Edition> to compare.
*
- * \attention
+ * \attention Edition::match compares two editions, treating empty
+ * version or release strings as wildcard. Thus match is not transitive,
+ * and you don't want to use it to order keys in a a std::container.
*
* \ingroup g_BackendSpecific
* \todo Define exceptions.
* // Editions sets use lexicographical order per default:
* std::set<Edition>
*
- * // An Edition set using Edition::comapre as order:
+ * // An Edition set using Edition::compare as order:
* std::set<Edition,CompareByLT<Edition> >;
*
- * // An Edition set using Edition::match as order:
- * std::set<Edition,CompareByLT<Edition,Edition::Match> >;
+ * // Edition::match is not transitive, thus not an appropriate
+ * // order relation for std::set or std::map.
* \endcode
*
* Classes like zypp:Range are templated by by type and general
* Expects \a _Compare to be suitable for use in \ref compareByRel.
* Defaults to Compare\<_Tp\>.
*/
+ template<class _Tp, class _Compare = Compare<_Tp> >
+ struct CompareBy : public std::binary_function<_Tp,_Tp,bool>
+ {
+ CompareBy( Rel op_r )
+ : _op( op_r )
+ {}
+
+ bool operator()( const _Tp & lhs, const _Tp & rhs ) const
+ { return compareByRel( _op, lhs, rhs, _Compare() ); }
+
+ Rel _op;
+ };
+
template<class _Tp, class _Compare = Compare<_Tp> >
struct CompareByEQ : public std::binary_function<_Tp,_Tp,bool>
{