From dc683521eed5981b783a2d379cfbfaea5e585285 Mon Sep 17 00:00:00 2001 From: Thibault Kruse Date: Thu, 11 Aug 2016 17:18:50 +0200 Subject: [PATCH] wrong sample class --- CppCoreGuidelines.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index 42ad27d..0e20c42 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -4169,7 +4169,7 @@ Note that if you define a destructor, you must define or delete [all default ope ~Smart_ptr2() { delete p; } // p is an owner! }; - void use(Smart_ptr p1) + void use(Smart_ptr2 p1) { auto p2 = p1; // error: double deletion } @@ -4440,8 +4440,8 @@ The C++11 initializer list rule eliminates the need for many constructors. For e Rec2(const string& ss, int ii = 0) :s{ss}, i{ii} {} // redundant }; - Rec r1 {"Foo", 7}; - Rec r2 {"Bar"}; + Rec2 r1 {"Foo", 7}; + Rec2 r2 {"Bar"}; The `Rec2` constructor is redundant. Also, the default for `int` would be better done as a [member initializer](#Rc-in-class-initializer).