Cut the ScopeGuard alias now that we have auto
authorYedidya Feldblum <yfeldblum@fb.com>
Thu, 11 Jan 2018 01:52:16 +0000 (17:52 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 11 Jan 2018 02:20:14 +0000 (18:20 -0800)
commit653053aa7a270129b35d405e3d196210c44ec6e2
treed0d31b24d37aad3db4ed12fb64e28c814dee6c74
parente61c21509306b8bad35427a3a768347d51c25e66
Cut the ScopeGuard alias now that we have auto

Summary:
[Folly] Cut the `ScopeGuard` alias now that we have `auto`.

This form works because of hidden lifetime extension:
```lang=c++
folly::ScopeGuard guard = folly::makeGuard([] { /*...*/ });
//  ...
//  guard falls out of scope
```
But this form would not work correctly:
```lang=c++
folly::ScopeGuard guard = folly::makeGuard([] { /*...*/ });
std::async(std::launch::async, [guard = std::move(guard)] {});
```
Because `folly::ScopeGuard` is an rvalue-reference-to-base.
We have `auto`, so just remove `folly::ScopeGuard`. This form works correctly:
```lang=c++
auto guard = folly::makeGuard([] { /*...*/ });
std::async(std::launch::async, [guard = std::move(guard)] {});
```

Reviewed By: igorsugak

Differential Revision: D6690070

fbshipit-source-id: 54e32b300d36fce4eb95a59f1828819afe312ec0
folly/ScopeGuard.h