Commit f39e6ad4 by Abseil Team Committed by Andy Getz

Export of internal Abseil changes

--
82011e44e917fb70fa00078f0bad7f787580bd8e by Abseil Team <absl-team@google.com>:

Add lifetime annotations to status methods that return references.

PiperOrigin-RevId: 391907063
GitOrigin-RevId: 82011e44e917fb70fa00078f0bad7f787580bd8e
Change-Id: Icb2cafbf5eb1201b3bdb56a17263073e22b642e7
parent a05366d8
...@@ -518,10 +518,10 @@ class StatusOr : private internal_statusor::StatusOrData<T>, ...@@ -518,10 +518,10 @@ class StatusOr : private internal_statusor::StatusOrData<T>,
// //
// The `std::move` on statusor instead of on the whole expression enables // The `std::move` on statusor instead of on the whole expression enables
// warnings about possible uses of the statusor object after the move. // warnings about possible uses of the statusor object after the move.
const T& value() const&; const T& value() const& ABSL_ATTRIBUTE_LIFETIME_BOUND;
T& value() &; T& value() & ABSL_ATTRIBUTE_LIFETIME_BOUND;
const T&& value() const&&; const T&& value() const&& ABSL_ATTRIBUTE_LIFETIME_BOUND;
T&& value() &&; T&& value() && ABSL_ATTRIBUTE_LIFETIME_BOUND;
// StatusOr<T>:: operator*() // StatusOr<T>:: operator*()
// //
...@@ -533,10 +533,10 @@ class StatusOr : private internal_statusor::StatusOrData<T>, ...@@ -533,10 +533,10 @@ class StatusOr : private internal_statusor::StatusOrData<T>,
// `absl::StatusOr<T>`. Alternatively, see the `value()` member function for a // `absl::StatusOr<T>`. Alternatively, see the `value()` member function for a
// similar API that guarantees crashing or throwing an exception if there is // similar API that guarantees crashing or throwing an exception if there is
// no current value. // no current value.
const T& operator*() const&; const T& operator*() const& ABSL_ATTRIBUTE_LIFETIME_BOUND;
T& operator*() &; T& operator*() & ABSL_ATTRIBUTE_LIFETIME_BOUND;
const T&& operator*() const&&; const T&& operator*() const&& ABSL_ATTRIBUTE_LIFETIME_BOUND;
T&& operator*() &&; T&& operator*() && ABSL_ATTRIBUTE_LIFETIME_BOUND;
// StatusOr<T>::operator->() // StatusOr<T>::operator->()
// //
...@@ -545,8 +545,8 @@ class StatusOr : private internal_statusor::StatusOrData<T>, ...@@ -545,8 +545,8 @@ class StatusOr : private internal_statusor::StatusOrData<T>,
// REQUIRES: `this->ok() == true`, otherwise the behavior is undefined. // REQUIRES: `this->ok() == true`, otherwise the behavior is undefined.
// //
// Use `this->ok()` to verify that there is a current value. // Use `this->ok()` to verify that there is a current value.
const T* operator->() const; const T* operator->() const ABSL_ATTRIBUTE_LIFETIME_BOUND;
T* operator->(); T* operator->() ABSL_ATTRIBUTE_LIFETIME_BOUND;
// StatusOr<T>::value_or() // StatusOr<T>::value_or()
// //
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment