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 | df6128370874866447314ec18d8e67fc7bde40b4 (patch) | |
tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 /util/generic/algorithm.h | |
parent | ca2a705e6e39e85df30054d7e806e572de9cfe23 (diff) | |
download | ydb-df6128370874866447314ec18d8e67fc7bde40b4.tar.gz |
Restoring authorship annotation for <kartynnik@yandex-team.ru>. Commit 2 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 ec8c0e9fae..badfb88993 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); |