From e3c6a01722639411bfdd4c980e55a9ee564d2ffe Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Wed, 11 May 2016 12:33:01 +0200 Subject: [PATCH] `ZRCola::index::compare_sort()` reverts to `compare()` by default now --- lib/libZRCola/include/zrcola/common.h | 6 +++++- lib/libZRCola/include/zrcola/language.h | 21 --------------------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/lib/libZRCola/include/zrcola/common.h b/lib/libZRCola/include/zrcola/common.h index 673f1cf..ea93f24 100644 --- a/lib/libZRCola/include/zrcola/common.h +++ b/lib/libZRCola/include/zrcola/common.h @@ -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); + } /// diff --git a/lib/libZRCola/include/zrcola/language.h b/lib/libZRCola/include/zrcola/language.h index 35d6ff2..29044c7 100644 --- a/lib/libZRCola/include/zrcola/language.h +++ b/lib/libZRCola/include/zrcola/language.h @@ -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 data; ///< Language data