diff --git a/_posts/2018-04-20-totw-120.md b/_posts/2018-04-20-totw-120.md index 9551da5..c5af48e 100644 --- a/_posts/2018-04-20-totw-120.md +++ b/_posts/2018-04-20-totw-120.md @@ -17,9 +17,9 @@ Let's suppose you have this code snippet, which seems to be working as expected: ```c++ absl::Status DoSomething() { absl::Status status; - auto log_on_error = absl::MakeCleanup([&status] { + absl::Cleanup log_on_error = [&status] { if (!status.ok()) LOG(ERROR) << status; - }); + }; status = DoA(); if (!status.ok()) return status; status = DoB(); @@ -108,9 +108,9 @@ absl::Status DoSomething() { // The 'return status;' statements will always copy the object and Logger // will always see the correct value. absl::Status& status = status_no_nrvo; - auto log_on_error = absl::MakeCleanup([&status] { + absl::Cleanup log_on_error = [&status] { if (!status.ok()) LOG(ERROR) << status; - }); + }; status = DoA(); if (!status.ok()) return status; status = DoB();