Commit 3020b58f by Laramie Leavitt Committed by Copybara-Service

Add ABSL_ATTRIBUTE_LIFETIME_BOUND to absl::StatusOr::emplace()

PiperOrigin-RevId: 506944023
Change-Id: I04ff13dcec89c57ba03707f5698c4198434216b6
parent 115aac77
......@@ -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)...);
......
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