diff options
author | sukhoi <sukhoi@yandex-team.ru> | 2022-02-10 16:51:35 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:51:35 +0300 |
commit | 31b383c710ee84e3470e22bcb85863a46acd951b (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 | |
parent | 01b069525b0643380d885e1549f9d1f1ecdfbb24 (diff) | |
download | ydb-31b383c710ee84e3470e22bcb85863a46acd951b.tar.gz |
Restoring authorship annotation for <sukhoi@yandex-team.ru>. Commit 2 of 2.
-rw-r--r-- | build/rules/contrib_python.policy | 2 | ||||
-rw-r--r-- | util/generic/algorithm.h | 20 | ||||
-rw-r--r-- | util/generic/algorithm_ut.cpp | 28 |
3 files changed, 25 insertions, 25 deletions
diff --git a/build/rules/contrib_python.policy b/build/rules/contrib_python.policy index ff75009b606..60fd1497533 100644 --- a/build/rules/contrib_python.policy +++ b/build/rules/contrib_python.policy @@ -236,7 +236,7 @@ ALLOW trust/processing_holder -> contrib/python/pycrypto ALLOW trust/tests/tests_trust_bindings -> contrib/python/pycrypto ALLOW yabs/server/tools/banner_user_choice -> contrib/python/pycrypto ALLOW yabs/server/test -> contrib/python/pycrypto -ALLOW ydo/database/active_record -> contrib/python/pycrypto +ALLOW ydo/database/active_record -> contrib/python/pycrypto ALLOW yweb/antispam/cid -> contrib/python/pycrypto ALLOW mail/payments/payments -> contrib/python/pycrypto DENY .* -> contrib/python/pycrypto diff --git a/util/generic/algorithm.h b/util/generic/algorithm.h index aa700a7c040..badfb889933 100644 --- a/util/generic/algorithm.h +++ b/util/generic/algorithm.h @@ -313,18 +313,18 @@ 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()); +template <class C> +void SortUnique(C& c) { + Sort(c.begin(), c.end()); c.erase(Unique(c.begin(), c.end()), c.end()); -} - -template <class C, class Cmp> -void SortUnique(C& c, Cmp cmp) { - Sort(c.begin(), c.end(), cmp); +} + +template <class C, class Cmp> +void SortUnique(C& c, Cmp cmp) { + Sort(c.begin(), c.end(), 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); diff --git a/util/generic/algorithm_ut.cpp b/util/generic/algorithm_ut.cpp index 1b6f8595dc9..8d732fcc0cf 100644 --- a/util/generic/algorithm_ut.cpp +++ b/util/generic/algorithm_ut.cpp @@ -224,7 +224,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { TVector<int> empty; UNIT_ASSERT_EQUAL(NPOS, FindIndex(empty, 0)); } - + Y_UNIT_TEST(FindIndexIfTest) { TVectorNoCopy v; v.push_back(1); @@ -248,23 +248,23 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { } Y_UNIT_TEST(SortUniqueTest) { - { + { TVector<TString> v; - SortUnique(v); + SortUnique(v); UNIT_ASSERT_EQUAL(v, TVector<TString>()); - } - - { - const char* ar[] = {"345", "3", "123", "2", "23", "3", "2"}; + } + + { + const char* ar[] = {"345", "3", "123", "2", "23", "3", "2"}; TVector<TString> v(ar, ar + Y_ARRAY_SIZE(ar)); - SortUnique(v); - - const char* suAr[] = {"123", "2", "23", "3", "345"}; + SortUnique(v); + + const char* suAr[] = {"123", "2", "23", "3", "345"}; TVector<TString> suV(suAr, suAr + Y_ARRAY_SIZE(suAr)); - - UNIT_ASSERT_EQUAL(v, suV); - } - } + + UNIT_ASSERT_EQUAL(v, suV); + } + } Y_UNIT_TEST(EraseTest) { TVector<int> data = {5, 4, 3, 2, 1, 0}; |