diff options
author | a-bocharov <a-bocharov@yandex-team.ru> | 2022-02-10 16:51:42 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:51:42 +0300 |
commit | cf85d9ecf529a02f41258fd39cbc1a1cee24525d (patch) | |
tree | f3c4df7bf12865ad24e1101cf22dbb1f3c8a920b | |
parent | 5e08c1c74c0a13a60738d33e4a9c4e0b21986b75 (diff) | |
download | ydb-cf85d9ecf529a02f41258fd39cbc1a1cee24525d.tar.gz |
Restoring authorship annotation for <a-bocharov@yandex-team.ru>. Commit 1 of 2.
-rwxr-xr-x | build/scripts/build_mn.py | 10 | ||||
-rw-r--r-- | util/generic/algorithm.h | 18 | ||||
-rw-r--r-- | util/generic/algorithm_ut.cpp | 44 |
3 files changed, 36 insertions, 36 deletions
diff --git a/build/scripts/build_mn.py b/build/scripts/build_mn.py index 5bb03c247c..081b9d97ac 100755 --- a/build/scripts/build_mn.py +++ b/build/scripts/build_mn.py @@ -50,10 +50,10 @@ class BuildMnBase(object): mncpptmpPath = self.mncppPath + ".tmp" mncpptmp = open(mncpptmpPath, 'w') - if self.multi: - mncpptmp.write("#include <kernel/matrixnet/mn_multi_categ.h>\n") - else: - mncpptmp.write("#include <kernel/matrixnet/mn_sse.h>\n") + if self.multi: + mncpptmp.write("#include <kernel/matrixnet/mn_multi_categ.h>\n") + else: + mncpptmp.write("#include <kernel/matrixnet/mn_sse.h>\n") rodatapath = os.path.dirname(self.mncppPath) + "/" + dataprefix + self.mnname + ".rodata" mncpptmp.write("namespace{\n") @@ -257,7 +257,7 @@ class BuildMns(BuildMnBase): if ext == ".info": mnnames.append(mnfilename) elif ext == ".mnmc": - mnmultinames.append(mnfilename) + mnmultinames.append(mnfilename) tmpSrcFile.write(self.autogen) tmpSrcFile.write("#include \"{0}\"\n\n".format(hdrrel)) diff --git a/util/generic/algorithm.h b/util/generic/algorithm.h index badfb88993..05a6c093ec 100644 --- a/util/generic/algorithm.h +++ b/util/generic/algorithm.h @@ -192,21 +192,21 @@ static inline auto FindIfPtr(C&& c, P pred) { } template <class C, class T> -static inline size_t FindIndex(C&& c, const T& x) { +static inline size_t FindIndex(C&& c, const T& x) { using std::begin; using std::end; auto it = Find(begin(c), end(c), x); return it == end(c) ? NPOS : (it - begin(c)); } -template <class C, class P> -static inline size_t FindIndexIf(C&& c, P p) { - using std::begin; - using std::end; - auto it = FindIf(begin(c), end(c), p); - return it == end(c) ? NPOS : (it - begin(c)); -} - +template <class C, class P> +static inline size_t FindIndexIf(C&& c, P p) { + using std::begin; + using std::end; + auto it = FindIf(begin(c), end(c), p); + return it == end(c) ? NPOS : (it - begin(c)); +} + //EqualToOneOf(x, "apple", "orange") means (x == "apple" || x == "orange") template <typename T> inline bool EqualToOneOf(const T&) { diff --git a/util/generic/algorithm_ut.cpp b/util/generic/algorithm_ut.cpp index 8d732fcc0c..87a41c89bb 100644 --- a/util/generic/algorithm_ut.cpp +++ b/util/generic/algorithm_ut.cpp @@ -225,28 +225,28 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { UNIT_ASSERT_EQUAL(NPOS, FindIndex(empty, 0)); } - Y_UNIT_TEST(FindIndexIfTest) { - TVectorNoCopy v; - v.push_back(1); - v.push_back(2); - v.push_back(3); - - UNIT_ASSERT_EQUAL(0, FindIndexIf(v, [](int x) { return x == 1; })); - UNIT_ASSERT_EQUAL(1, FindIndexIf(v, [](int x) { return x == 2; })); - UNIT_ASSERT_EQUAL(2, FindIndexIf(v, [](int x) { return x == 3; })); - UNIT_ASSERT_EQUAL(NPOS, FindIndexIf(v, [](int x) { return x == 42; })); - - int array[3] = {1, 2, 3}; - - UNIT_ASSERT_EQUAL(0, FindIndexIf(array, [](int x) { return x == 1; })); - UNIT_ASSERT_EQUAL(1, FindIndexIf(array, [](int x) { return x == 2; })); - UNIT_ASSERT_EQUAL(2, FindIndexIf(array, [](int x) { return x == 3; })); - UNIT_ASSERT_EQUAL(NPOS, FindIndexIf(array, [](int x) { return x == 42; })); - - TVector<int> empty; - UNIT_ASSERT_EQUAL(NPOS, FindIndexIf(empty, [](int x) { return x == 3; })); - } - + Y_UNIT_TEST(FindIndexIfTest) { + TVectorNoCopy v; + v.push_back(1); + v.push_back(2); + v.push_back(3); + + UNIT_ASSERT_EQUAL(0, FindIndexIf(v, [](int x) { return x == 1; })); + UNIT_ASSERT_EQUAL(1, FindIndexIf(v, [](int x) { return x == 2; })); + UNIT_ASSERT_EQUAL(2, FindIndexIf(v, [](int x) { return x == 3; })); + UNIT_ASSERT_EQUAL(NPOS, FindIndexIf(v, [](int x) { return x == 42; })); + + int array[3] = {1, 2, 3}; + + UNIT_ASSERT_EQUAL(0, FindIndexIf(array, [](int x) { return x == 1; })); + UNIT_ASSERT_EQUAL(1, FindIndexIf(array, [](int x) { return x == 2; })); + UNIT_ASSERT_EQUAL(2, FindIndexIf(array, [](int x) { return x == 3; })); + UNIT_ASSERT_EQUAL(NPOS, FindIndexIf(array, [](int x) { return x == 42; })); + + TVector<int> empty; + UNIT_ASSERT_EQUAL(NPOS, FindIndexIf(empty, [](int x) { return x == 3; })); + } + Y_UNIT_TEST(SortUniqueTest) { { TVector<TString> v; |