diff options
author | swarmer <swarmer@yandex-team.ru> | 2022-02-10 16:46:31 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:31 +0300 |
commit | 317da38588b7898a99fd9168571408123350012b (patch) | |
tree | 25eebc31526019ad39a6c1b13f492963d97ba439 /util/generic/maybe.h | |
parent | 3b2241461d41d41ba1a706b0750c4f0f55c344f6 (diff) | |
download | ydb-317da38588b7898a99fd9168571408123350012b.tar.gz |
Restoring authorship annotation for <swarmer@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/maybe.h')
-rw-r--r-- | util/generic/maybe.h | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/util/generic/maybe.h b/util/generic/maybe.h index 34d21aebcd..e853c43d97 100644 --- a/util/generic/maybe.h +++ b/util/generic/maybe.h @@ -300,7 +300,7 @@ public: } void CheckDefined() const { - if (Y_UNLIKELY(!Defined())) { + if (Y_UNLIKELY(!Defined())) { Policy::OnEmpty(typeid(TValueType)); } } @@ -313,46 +313,46 @@ public: return Defined() ? Data() : nullptr; } - constexpr const T& GetRef() const& { + constexpr const T& GetRef() const& { CheckDefined(); return *Data(); } - constexpr T& GetRef() & { + constexpr T& GetRef() & { CheckDefined(); return *Data(); } - constexpr const T&& GetRef() const&& { - CheckDefined(); - - return std::move(*Data()); - } - - constexpr T&& GetRef() && { - CheckDefined(); - - return std::move(*Data()); - } - - constexpr const T& operator*() const& { + constexpr const T&& GetRef() const&& { + CheckDefined(); + + return std::move(*Data()); + } + + constexpr T&& GetRef() && { + CheckDefined(); + + return std::move(*Data()); + } + + constexpr const T& operator*() const& { return GetRef(); } - constexpr T& operator*() & { + constexpr T& operator*() & { return GetRef(); } - constexpr const T&& operator*() const&& { - return std::move(GetRef()); - } - - constexpr T&& operator*() && { - return std::move(GetRef()); - } - + constexpr const T&& operator*() const&& { + return std::move(GetRef()); + } + + constexpr T&& operator*() && { + return std::move(GetRef()); + } + constexpr const T* operator->() const { return &GetRef(); } |