diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/threading/skip_list/compare.h | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/threading/skip_list/compare.h')
-rw-r--r-- | library/cpp/threading/skip_list/compare.h | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/library/cpp/threading/skip_list/compare.h b/library/cpp/threading/skip_list/compare.h index ac98b3e1ce..336582a1b8 100644 --- a/library/cpp/threading/skip_list/compare.h +++ b/library/cpp/threading/skip_list/compare.h @@ -4,74 +4,74 @@ #include <util/str_stl.h> namespace NThreading { - namespace NImpl { - Y_HAS_MEMBER(compare); - Y_HAS_MEMBER(Compare); + namespace NImpl { + Y_HAS_MEMBER(compare); + Y_HAS_MEMBER(Compare); template <typename T> - inline int CompareImpl(const T& l, const T& r) { - if (l < r) { - return -1; - } else if (r < l) { - return +1; - } else { - return 0; - } + inline int CompareImpl(const T& l, const T& r) { + if (l < r) { + return -1; + } else if (r < l) { + return +1; + } else { + return 0; + } } - template <bool val> - struct TSmallCompareSelector { - template <typename T> - static inline int Compare(const T& l, const T& r) { - return CompareImpl(l, r); - } - }; + template <bool val> + struct TSmallCompareSelector { + template <typename T> + static inline int Compare(const T& l, const T& r) { + return CompareImpl(l, r); + } + }; - template <> - struct TSmallCompareSelector<true> { - template <typename T> - static inline int Compare(const T& l, const T& r) { - return l.compare(r); - } - }; + template <> + struct TSmallCompareSelector<true> { + template <typename T> + static inline int Compare(const T& l, const T& r) { + return l.compare(r); + } + }; - template <bool val> - struct TBigCompareSelector { - template <typename T> - static inline int Compare(const T& l, const T& r) { + template <bool val> + struct TBigCompareSelector { + template <typename T> + static inline int Compare(const T& l, const T& r) { return TSmallCompareSelector<THascompare<T>::value>::Compare(l, r); - } - }; - - template <> - struct TBigCompareSelector<true> { - template <typename T> - static inline int Compare(const T& l, const T& r) { - return l.Compare(r); - } - }; - + } + }; + + template <> + struct TBigCompareSelector<true> { + template <typename T> + static inline int Compare(const T& l, const T& r) { + return l.Compare(r); + } + }; + template <typename T> struct TCompareSelector: public TBigCompareSelector<THasCompare<T>::value> { - }; - } - - //////////////////////////////////////////////////////////////////////////////// - // Generic compare function + }; + } + //////////////////////////////////////////////////////////////////////////////// + // Generic compare function + template <typename T> - inline int Compare(const T& l, const T& r) { - return NImpl::TCompareSelector<T>::Compare(l, r); - } - - //////////////////////////////////////////////////////////////////////////////// - // Generic compare functor - - template <typename T> - struct TCompare { - inline int operator()(const T& l, const T& r) const { - return Compare(l, r); - } + inline int Compare(const T& l, const T& r) { + return NImpl::TCompareSelector<T>::Compare(l, r); + } + + //////////////////////////////////////////////////////////////////////////////// + // Generic compare functor + + template <typename T> + struct TCompare { + inline int operator()(const T& l, const T& r) const { + return Compare(l, r); + } }; } |