E.19: clarify that `finally` is from the GSL (#1936)

When I stumbled upon E.19 "Use a `final_action` object to express
cleanup if no suitable resource handle is available" I was hopeful
that this `final_action`/`finally()` thing is from the STL, but, alas,
it isn't.

Make it clear that `finally` is a GSL construct.
pull/1939/head
Gábor Szeder 2022-07-13 18:05:36 +02:00 committed by GitHub
parent fde9ee5de1
commit 42c4cc6a75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -16216,14 +16216,14 @@ Better:
##### Reason
`finally` is less verbose and harder to get wrong than `try`/`catch`.
`finally` from the [GSL](#S-gsl) is less verbose and harder to get wrong than `try`/`catch`.
##### Example
void f(int n)
{
void* p = malloc(n);
auto _ = finally([p] { free(p); });
auto _ = gsl::finally([p] { free(p); });
// ...
}