aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorswarmer <swarmer@yandex-team.com>2023-12-16 03:34:20 +0300
committerswarmer <swarmer@yandex-team.com>2023-12-16 04:01:14 +0300
commit469e936f82d9914c0ef2e9f2238ac7fe90f024a7 (patch)
treeb195a0742f95f7983644c575e26170c32084c43d
parent5e24e6b9a7c798423b0e89c6bbe3cd6ae9c0155c (diff)
downloadydb-469e936f82d9914c0ef2e9f2238ac7fe90f024a7.tar.gz
detect dangling references in TMaybe object
-rw-r--r--util/generic/maybe.h36
1 files changed, 18 insertions, 18 deletions
diff --git a/util/generic/maybe.h b/util/generic/maybe.h
index 633eb1b843..8498afda34 100644
--- a/util/generic/maybe.h
+++ b/util/generic/maybe.h
@@ -306,75 +306,75 @@ public:
}
}
- const T* Get() const noexcept {
+ const T* Get() const noexcept Y_LIFETIME_BOUND {
return Defined() ? Data() : nullptr;
}
- T* Get() noexcept {
+ T* Get() noexcept Y_LIFETIME_BOUND {
return Defined() ? Data() : nullptr;
}
- constexpr const T& GetRef() const& {
+ constexpr const T& GetRef() const& Y_LIFETIME_BOUND {
CheckDefined();
return *Data();
}
- constexpr T& GetRef() & {
+ constexpr T& GetRef() & Y_LIFETIME_BOUND {
CheckDefined();
return *Data();
}
- constexpr const T&& GetRef() const&& {
+ constexpr const T&& GetRef() const&& Y_LIFETIME_BOUND {
CheckDefined();
return std::move(*Data());
}
- constexpr T&& GetRef() && {
+ constexpr T&& GetRef() && Y_LIFETIME_BOUND {
CheckDefined();
return std::move(*Data());
}
- constexpr const T& operator*() const& {
+ constexpr const T& operator*() const& Y_LIFETIME_BOUND {
return GetRef();
}
- constexpr T& operator*() & {
+ constexpr T& operator*() & Y_LIFETIME_BOUND {
return GetRef();
}
- constexpr const T&& operator*() const&& {
+ constexpr const T&& operator*() const&& Y_LIFETIME_BOUND {
return std::move(GetRef());
}
- constexpr T&& operator*() && {
+ constexpr T&& operator*() && Y_LIFETIME_BOUND {
return std::move(GetRef());
}
- constexpr const T* operator->() const {
+ constexpr const T* operator->() const Y_LIFETIME_BOUND {
return &GetRef();
}
- constexpr T* operator->() {
+ constexpr T* operator->() Y_LIFETIME_BOUND {
return &GetRef();
}
- constexpr const T& GetOrElse(const T& elseValue) const {
+ constexpr const T& GetOrElse(const T& elseValue Y_LIFETIME_BOUND) const Y_LIFETIME_BOUND {
return Defined() ? *Data() : elseValue;
}
- constexpr T& GetOrElse(T& elseValue) {
+ constexpr T& GetOrElse(T& elseValue Y_LIFETIME_BOUND) Y_LIFETIME_BOUND {
return Defined() ? *Data() : elseValue;
}
- constexpr const TMaybe& OrElse(const TMaybe& elseValue) const noexcept {
+ constexpr const TMaybe& OrElse(const TMaybe& elseValue Y_LIFETIME_BOUND) const noexcept Y_LIFETIME_BOUND {
return Defined() ? *this : elseValue;
}
- constexpr TMaybe& OrElse(TMaybe& elseValue) {
+ constexpr TMaybe& OrElse(TMaybe& elseValue Y_LIFETIME_BOUND) Y_LIFETIME_BOUND {
return Defined() ? *this : elseValue;
}
@@ -434,11 +434,11 @@ public:
}
private:
- constexpr const T* Data() const noexcept {
+ constexpr const T* Data() const noexcept Y_LIFETIME_BOUND {
return std::addressof(this->Data_);
}
- constexpr T* Data() noexcept {
+ constexpr T* Data() noexcept Y_LIFETIME_BOUND {
return std::addressof(this->Data_);
}