ZRCola::index::compare_sort() reverts to compare() by default now

This commit is contained in:
Simon Rozman 2016-05-11 12:33:01 +02:00
parent 0d30a89d22
commit e3c6a01722
2 changed files with 5 additions and 22 deletions

View File

@ -182,7 +182,11 @@ namespace ZRCola {
/// - =0 when a == b
/// - >0 when a > b
///
virtual int compare_sort(_In_ const T_data &a, _In_ const T_data &b) const = 0;
virtual int compare_sort(_In_ const T_data &a, _In_ const T_data &b) const
{
// Revert to `compare()` by default.
return compare(a, b);
}
///

View File

@ -238,27 +238,6 @@ namespace ZRCola {
return 0;
}
///
/// Compares two languages by ID (for sorting)
///
/// \param[in] a Pointer to first element
/// \param[in] b Pointer to second element
///
/// \returns
/// - <0 when a < b
/// - =0 when a == b
/// - >0 when a > b
///
virtual int compare_sort(_In_ const language &a, _In_ const language &b) const
{
int r = memcmp(a.id, b.id, sizeof(langid_t));
if (r != 0) return r;
// As the language ID must not duplicate, further comparison is pointless.
return 0;
}
} idxLng; ///< Language index
std::vector<unsigned __int16> data; ///< Language data