aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/containers
diff options
context:
space:
mode:
authorsankear <sankear@yandex-team.ru>2022-02-10 16:50:10 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:10 +0300
commitaed1c1c7782eb0a0536e5b25bbed950b397e0ac8 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/containers
parent7377d7b033ffbef85e9bb0bf35091a8e79ed422c (diff)
downloadydb-aed1c1c7782eb0a0536e5b25bbed950b397e0ac8.tar.gz
Restoring authorship annotation for <sankear@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/containers')
-rw-r--r--library/cpp/containers/top_keeper/top_keeper.h38
-rw-r--r--library/cpp/containers/top_keeper/top_keeper/top_keeper.h38
2 files changed, 38 insertions, 38 deletions
diff --git a/library/cpp/containers/top_keeper/top_keeper.h b/library/cpp/containers/top_keeper/top_keeper.h
index 670561b0af7..2f282b5a9e1 100644
--- a/library/cpp/containers/top_keeper/top_keeper.h
+++ b/library/cpp/containers/top_keeper/top_keeper.h
@@ -22,16 +22,16 @@ private:
template <class UT>
bool Insert(UT&& value) noexcept {
- if (Y_UNLIKELY(0 == HalfMaxSize)) {
+ if (Y_UNLIKELY(0 == HalfMaxSize)) {
return false;
}
- if (Internal.size() < HalfMaxSize) {
+ if (Internal.size() < HalfMaxSize) {
if (Internal.empty() || Comparer(Internal[MinElementIndex], value)) {
MinElementIndex = Internal.size();
- Internal.push_back(std::forward<UT>(value));
- return true;
- }
+ Internal.push_back(std::forward<UT>(value));
+ return true;
+ }
} else if (!Comparer(value, Internal[MinElementIndex])) {
return false;
}
@@ -69,11 +69,11 @@ private:
}
void Partition() {
- if (Y_UNLIKELY(HalfMaxSize == 0)) {
- return;
- }
- if (Y_LIKELY(Internal.size() >= HalfMaxSize)) {
- NthElement(Internal.begin(), Internal.begin() + HalfMaxSize - 1, Internal.end(), Comparer);
+ if (Y_UNLIKELY(HalfMaxSize == 0)) {
+ return;
+ }
+ if (Y_LIKELY(Internal.size() >= HalfMaxSize)) {
+ NthElement(Internal.begin(), Internal.begin() + HalfMaxSize - 1, Internal.end(), Comparer);
Internal.erase(Internal.begin() + HalfMaxSize, Internal.end());
//we should update MinElementIndex cause we just altered Internal
@@ -96,7 +96,7 @@ private:
void SetMaxSize(size_t newHalfMaxSize) {
HalfMaxSize = newHalfMaxSize;
- Reserve();
+ Reserve();
Partition();
}
@@ -142,14 +142,14 @@ private:
bool Finalized;
public:
- TTopKeeper()
- : MaxSize(0)
- , Comparer()
- , Internal(0, Comparer)
- , Finalized(false)
- {
- }
-
+ TTopKeeper()
+ : MaxSize(0)
+ , Comparer()
+ , Internal(0, Comparer)
+ , Finalized(false)
+ {
+ }
+
TTopKeeper(size_t maxSize, const TComparator& comp = TComparator())
: MaxSize(maxSize)
, Comparer(comp)
diff --git a/library/cpp/containers/top_keeper/top_keeper/top_keeper.h b/library/cpp/containers/top_keeper/top_keeper/top_keeper.h
index 670561b0af7..2f282b5a9e1 100644
--- a/library/cpp/containers/top_keeper/top_keeper/top_keeper.h
+++ b/library/cpp/containers/top_keeper/top_keeper/top_keeper.h
@@ -22,16 +22,16 @@ private:
template <class UT>
bool Insert(UT&& value) noexcept {
- if (Y_UNLIKELY(0 == HalfMaxSize)) {
+ if (Y_UNLIKELY(0 == HalfMaxSize)) {
return false;
}
- if (Internal.size() < HalfMaxSize) {
+ if (Internal.size() < HalfMaxSize) {
if (Internal.empty() || Comparer(Internal[MinElementIndex], value)) {
MinElementIndex = Internal.size();
- Internal.push_back(std::forward<UT>(value));
- return true;
- }
+ Internal.push_back(std::forward<UT>(value));
+ return true;
+ }
} else if (!Comparer(value, Internal[MinElementIndex])) {
return false;
}
@@ -69,11 +69,11 @@ private:
}
void Partition() {
- if (Y_UNLIKELY(HalfMaxSize == 0)) {
- return;
- }
- if (Y_LIKELY(Internal.size() >= HalfMaxSize)) {
- NthElement(Internal.begin(), Internal.begin() + HalfMaxSize - 1, Internal.end(), Comparer);
+ if (Y_UNLIKELY(HalfMaxSize == 0)) {
+ return;
+ }
+ if (Y_LIKELY(Internal.size() >= HalfMaxSize)) {
+ NthElement(Internal.begin(), Internal.begin() + HalfMaxSize - 1, Internal.end(), Comparer);
Internal.erase(Internal.begin() + HalfMaxSize, Internal.end());
//we should update MinElementIndex cause we just altered Internal
@@ -96,7 +96,7 @@ private:
void SetMaxSize(size_t newHalfMaxSize) {
HalfMaxSize = newHalfMaxSize;
- Reserve();
+ Reserve();
Partition();
}
@@ -142,14 +142,14 @@ private:
bool Finalized;
public:
- TTopKeeper()
- : MaxSize(0)
- , Comparer()
- , Internal(0, Comparer)
- , Finalized(false)
- {
- }
-
+ TTopKeeper()
+ : MaxSize(0)
+ , Comparer()
+ , Internal(0, Comparer)
+ , Finalized(false)
+ {
+ }
+
TTopKeeper(size_t maxSize, const TComparator& comp = TComparator())
: MaxSize(maxSize)
, Comparer(comp)