From 3140dde4287b7e6fc515d84a79fe0dc173af3c08 Mon Sep 17 00:00:00 2001 From: RicoAntonioFelix Date: Wed, 11 Nov 2015 08:28:59 -0400 Subject: [PATCH] Added missing capture clause in lambda expression and missing variable name from declaration of file object... --- CppCoreGuidelines.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index cb26077..a677674 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -6701,7 +6701,7 @@ If you don't, an exception or a return may lead to a leak. { FILE* f = fopen(name, "r"); // open the file vector buf(1024); - auto _ = finally([] { fclose(f); }) // remember to close the file + auto _ = finally([f] { fclose(f); }) // remember to close the file // ... } @@ -6711,7 +6711,7 @@ The allocation of `buf` may fail and leak the file handle. void f(const string& name) { - ifstream {name, "r"}; // open the file + ifstream f{name, "r"}; // open the file vector buf(1024); // ... }