diff options
author | swarmer <swarmer@yandex-team.com> | 2024-08-08 00:09:27 +0300 |
---|---|---|
committer | swarmer <swarmer@yandex-team.com> | 2024-08-08 00:41:56 +0300 |
commit | f6bef9fbea60ca539cc741158e4762ff1b949e69 (patch) | |
tree | ea821fe798e13c8b39715347911928a5b1a63081 /util | |
parent | 38cff6773bff060c5772a03ad45f5d4b6ef8afe1 (diff) | |
download | ydb-f6bef9fbea60ca539cc741158e4762ff1b949e69.tar.gz |
check the lifetime bounds of the explicit_type, the lazy_value, and the queue containers
5f83506ef4fb80da806490df993e39a22d6c010a
Diffstat (limited to 'util')
-rw-r--r-- | util/generic/explicit_type.h | 2 | ||||
-rw-r--r-- | util/generic/lazy_value.h | 6 | ||||
-rw-r--r-- | util/generic/queue.h | 8 |
3 files changed, 8 insertions, 8 deletions
diff --git a/util/generic/explicit_type.h b/util/generic/explicit_type.h index 34e269f155..41f85f52a0 100644 --- a/util/generic/explicit_type.h +++ b/util/generic/explicit_type.h @@ -24,7 +24,7 @@ template <class T> class TExplicitType { public: template <class OtherT> - TExplicitType(const OtherT& value, std::enable_if_t<std::is_same<OtherT, T>::value>* = nullptr) noexcept + TExplicitType(const OtherT& value Y_LIFETIME_BOUND, std::enable_if_t<std::is_same<OtherT, T>::value>* = nullptr) noexcept : Value_(value) { } diff --git a/util/generic/lazy_value.h b/util/generic/lazy_value.h index e54cdb31d0..8dd53b763d 100644 --- a/util/generic/lazy_value.h +++ b/util/generic/lazy_value.h @@ -19,18 +19,18 @@ public: return ValueHolder.Defined(); } - const T& GetRef() const { + const T& GetRef() const Y_LIFETIME_BOUND { if (!WasLazilyInitialized()) { InitDefault(); } return *ValueHolder; } - const T& operator*() const { + const T& operator*() const Y_LIFETIME_BOUND { return GetRef(); } - const T* operator->() const { + const T* operator->() const Y_LIFETIME_BOUND { return &GetRef(); } diff --git a/util/generic/queue.h b/util/generic/queue.h index f5959f68f2..012ac80082 100644 --- a/util/generic/queue.h +++ b/util/generic/queue.h @@ -24,11 +24,11 @@ public: this->c.clear(); } - inline S& Container() { + inline S& Container() Y_LIFETIME_BOUND { return this->c; } - inline const S& Container() const { + inline const S& Container() const Y_LIFETIME_BOUND { return this->c; } }; @@ -48,11 +48,11 @@ public: this->c.clear(); } - inline S& Container() { + inline S& Container() Y_LIFETIME_BOUND { return this->c; } - inline const S& Container() const { + inline const S& Container() const Y_LIFETIME_BOUND { return this->c; } }; |