aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/algorithm.h
diff options
context:
space:
mode:
authorRuslan Kovalev <ruslan.a.kovalev@gmail.com>2022-02-10 16:46:45 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:45 +0300
commit9123176b341b6f2658cff5132482b8237c1416c8 (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /util/generic/algorithm.h
parent59e19371de37995fcb36beb16cd6ec030af960bc (diff)
downloadydb-9123176b341b6f2658cff5132482b8237c1416c8.tar.gz
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'util/generic/algorithm.h')
-rw-r--r--util/generic/algorithm.h32
1 files changed, 16 insertions, 16 deletions
diff --git a/util/generic/algorithm.h b/util/generic/algorithm.h
index 3d73275c31..badfb88993 100644
--- a/util/generic/algorithm.h
+++ b/util/generic/algorithm.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "is_in.h"
#include "utility.h"
@@ -308,11 +308,11 @@ static inline T Unique(T f, T l, P p) {
return std::unique(f, l, p);
}
-template <class T, class TGetKey>
-static inline T UniqueBy(T f, T l, const TGetKey& getKey) {
- return Unique(f, l, [&](auto&& left, auto&& right) { return getKey(left) == getKey(right); });
-}
-
+template <class T, class TGetKey>
+static inline T UniqueBy(T f, T l, const TGetKey& getKey) {
+ return Unique(f, l, [&](auto&& left, auto&& right) { return getKey(left) == getKey(right); });
+}
+
template <class C>
void SortUnique(C& c) {
Sort(c.begin(), c.end());
@@ -325,18 +325,18 @@ void SortUnique(C& c, Cmp cmp) {
c.erase(Unique(c.begin(), c.end()), c.end());
}
-template <class C, class TGetKey>
-void SortUniqueBy(C& c, const TGetKey& getKey) {
- SortBy(c, getKey);
+template <class C, class TGetKey>
+void SortUniqueBy(C& c, const TGetKey& getKey) {
+ SortBy(c, getKey);
c.erase(UniqueBy(c.begin(), c.end(), getKey), c.end());
-}
-
-template <class C, class TGetKey>
-void StableSortUniqueBy(C& c, const TGetKey& getKey) {
- StableSortBy(c, getKey);
+}
+
+template <class C, class TGetKey>
+void StableSortUniqueBy(C& c, const TGetKey& getKey) {
+ StableSortBy(c, getKey);
c.erase(UniqueBy(c.begin(), c.end(), getKey), c.end());
-}
-
+}
+
template <class C, class TValue>
void Erase(C& c, const TValue& value) {
c.erase(std::remove(c.begin(), c.end(), value), c.end());