diff options
author | kartynnik <kartynnik@yandex-team.ru> | 2022-02-10 16:48:07 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:07 +0300 |
commit | ca2a705e6e39e85df30054d7e806e572de9cfe23 (patch) | |
tree | fb7cc52bc2579366b2796a24f91f6df7a223f9ab /util/generic/algorithm.h | |
parent | e20e2b362f0232ed5a389db887e6e27e7763af18 (diff) | |
download | ydb-ca2a705e6e39e85df30054d7e806e572de9cfe23.tar.gz |
Restoring authorship annotation for <kartynnik@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/algorithm.h')
-rw-r--r-- | util/generic/algorithm.h | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/util/generic/algorithm.h b/util/generic/algorithm.h index badfb88993..ec8c0e9fae 100644 --- a/util/generic/algorithm.h +++ b/util/generic/algorithm.h @@ -34,35 +34,35 @@ namespace NPrivate { } template <class T> -static inline void Sort(T f, T l) { +static inline void Sort(T f, T l) { std::sort(f, l); } template <class T, class C> -static inline void Sort(T f, T l, C c) { +static inline void Sort(T f, T l, C c) { std::sort(f, l, c); } -template <class TContainer> -static inline void Sort(TContainer& container) { - Sort(container.begin(), container.end()); -} - -template <class TContainer, typename TCompare> -static inline void Sort(TContainer& container, TCompare compare) { - Sort(container.begin(), container.end(), compare); -} - -template <class TIterator, typename TGetKey> -static inline void SortBy(TIterator begin, TIterator end, const TGetKey& getKey) { +template <class TContainer> +static inline void Sort(TContainer& container) { + Sort(container.begin(), container.end()); +} + +template <class TContainer, typename TCompare> +static inline void Sort(TContainer& container, TCompare compare) { + Sort(container.begin(), container.end(), compare); +} + +template <class TIterator, typename TGetKey> +static inline void SortBy(TIterator begin, TIterator end, const TGetKey& getKey) { Sort(begin, end, [&](auto&& left, auto&& right) { return getKey(left) < getKey(right); }); -} - -template <class TContainer, typename TGetKey> -static inline void SortBy(TContainer& container, const TGetKey& getKey) { - SortBy(container.begin(), container.end(), getKey); -} - +} + +template <class TContainer, typename TGetKey> +static inline void SortBy(TContainer& container, const TGetKey& getKey) { + SortBy(container.begin(), container.end(), getKey); +} + template <class T> static inline void StableSort(T f, T l) { std::stable_sort(f, l); |