diff options
author | Ivan Korostelev <ivan.korostelev@gmail.com> | 2022-02-10 16:46:41 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:41 +0300 |
commit | f3a52f9d3e18d1159abbc85fa65eeda69d971657 (patch) | |
tree | 203885df8c9af6c414a9ec107514b91912970ab9 /util/generic | |
parent | 99609724f661f7e21d1cb08e8d80e87c3632fdb3 (diff) | |
download | ydb-f3a52f9d3e18d1159abbc85fa65eeda69d971657.tar.gz |
Restoring authorship annotation for Ivan Korostelev <ivan.korostelev@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'util/generic')
-rw-r--r-- | util/generic/maybe.h | 8 | ||||
-rw-r--r-- | util/generic/maybe_ut.cpp | 22 |
2 files changed, 15 insertions, 15 deletions
diff --git a/util/generic/maybe.h b/util/generic/maybe.h index 34d21aebcd..1e21f07e9c 100644 --- a/util/generic/maybe.h +++ b/util/generic/maybe.h @@ -447,7 +447,7 @@ private: this->Defined_ = true; } }; - + template <class T> using TMaybeFail = TMaybe<T, NMaybe::TPolicyUndefinedFail>; @@ -492,12 +492,12 @@ constexpr bool operator==(const ::TMaybe<T, TPolicy>& left, const ::TMaybe<T, TP !static_cast<bool>(left) ? true : *left == *right); -} - +} + template <class T, class TPolicy> constexpr bool operator!=(const TMaybe<T, TPolicy>& left, const TMaybe<T, TPolicy>& right) { return !(left == right); -} +} template <class T, class TPolicy> constexpr bool operator<(const TMaybe<T, TPolicy>& left, const TMaybe<T, TPolicy>& right) { diff --git a/util/generic/maybe_ut.cpp b/util/generic/maybe_ut.cpp index 2c1a425c5e..597e725819 100644 --- a/util/generic/maybe_ut.cpp +++ b/util/generic/maybe_ut.cpp @@ -103,7 +103,7 @@ Y_UNIT_TEST_SUITE(TMaybeTest) { UNIT_ASSERT(!m5.Defined()); UNIT_ASSERT(m5.Empty()); UNIT_ASSERT(m5 == TMaybe<int>()); - UNIT_ASSERT(m5 == Nothing()); + UNIT_ASSERT(m5 == Nothing()); UNIT_ASSERT(m5 != TMaybe<int>(4)); m5 = 4; @@ -115,7 +115,7 @@ Y_UNIT_TEST_SUITE(TMaybeTest) { UNIT_ASSERT(m5 == TMaybe<int>(4)); UNIT_ASSERT(m5 != TMaybe<int>(3)); UNIT_ASSERT(m5 != TMaybe<int>()); - UNIT_ASSERT(m5 != Nothing()); + UNIT_ASSERT(m5 != Nothing()); m5 = TMaybe<int>(5); UNIT_ASSERT(m5.Defined()); @@ -126,16 +126,16 @@ Y_UNIT_TEST_SUITE(TMaybeTest) { m5 = TMaybe<int>(); UNIT_ASSERT(m5.Empty()); UNIT_ASSERT(m5 == TMaybe<int>()); - UNIT_ASSERT(m5 == Nothing()); - UNIT_ASSERT(m5 != TMaybe<int>(5)); - - m5 = 4; - m5 = Nothing(); - - UNIT_ASSERT(m5.Empty()); - UNIT_ASSERT(m5 == TMaybe<int>()); - UNIT_ASSERT(m5 == Nothing()); + UNIT_ASSERT(m5 == Nothing()); UNIT_ASSERT(m5 != TMaybe<int>(5)); + + m5 = 4; + m5 = Nothing(); + + UNIT_ASSERT(m5.Empty()); + UNIT_ASSERT(m5 == TMaybe<int>()); + UNIT_ASSERT(m5 == Nothing()); + UNIT_ASSERT(m5 != TMaybe<int>(5)); m5 = {}; UNIT_ASSERT(m5.Empty()); |