diff options
author | Laramie Leavitt <lar@google.com> | 2023-02-03 10:55:01 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-02-03 10:56:00 -0800 |
commit | 3020b58f0d987073b8adab204426f82c3f60b283 (patch) | |
tree | 69ea2d3827725c4a84569c78dabc0f2228284c1b /absl/status | |
parent | 115aac772c23907df48e298ebee04154bb2805c5 (diff) |
Add ABSL_ATTRIBUTE_LIFETIME_BOUND to absl::StatusOr::emplace()
PiperOrigin-RevId: 506944023
Change-Id: I04ff13dcec89c57ba03707f5698c4198434216b6
Diffstat (limited to 'absl/status')
-rw-r--r-- | absl/status/statusor.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/absl/status/statusor.h b/absl/status/statusor.h index a76e7201..beedd795 100644 --- a/absl/status/statusor.h +++ b/absl/status/statusor.h @@ -584,7 +584,7 @@ class StatusOr : private internal_statusor::StatusOrData<T>, // Reconstructs the inner value T in-place using the provided args, using the // T(args...) constructor. Returns reference to the reconstructed `T`. template <typename... Args> - T& emplace(Args&&... args) { + T& emplace(Args&&... args) ABSL_ATTRIBUTE_LIFETIME_BOUND { if (ok()) { this->Clear(); this->MakeValue(std::forward<Args>(args)...); @@ -600,7 +600,8 @@ class StatusOr : private internal_statusor::StatusOrData<T>, absl::enable_if_t< std::is_constructible<T, std::initializer_list<U>&, Args&&...>::value, int> = 0> - T& emplace(std::initializer_list<U> ilist, Args&&... args) { + T& emplace(std::initializer_list<U> ilist, + Args&&... args) ABSL_ATTRIBUTE_LIFETIME_BOUND { if (ok()) { this->Clear(); this->MakeValue(ilist, std::forward<Args>(args)...); |