From 0a58ed2bc3d57fb7349854eb21d33b78ca5f1650 Mon Sep 17 00:00:00 2001 From: beinhaerter <34543625+beinhaerter@users.noreply.github.com> Date: Mon, 1 Jul 2019 15:56:53 +0200 Subject: [PATCH] C.150/C.151: fix compiler syntax error in Example (#1461) - remove unnecessary space in section Reason --- CppCoreGuidelines.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index a127043..2f7e7f4 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -7904,12 +7904,12 @@ Avoid resource leaks. ##### Reason - `make_unique` gives a more concise statement of the construction. +`make_unique` gives a more concise statement of the construction. It also ensures exception safety in complex expressions. ##### Example - unique_ptr p {new{7}}; // OK: but repetitive + unique_ptr p {new Foo{7}}; // OK: but repetitive auto q = make_unique(7); // Better: no repetition of Foo @@ -7935,14 +7935,14 @@ It also ensures exception safety in complex expressions. ##### Reason - `make_shared` gives a more concise statement of the construction. +`make_shared` gives a more concise statement of the construction. It also gives an opportunity to eliminate a separate allocation for the reference counts, by placing the `shared_ptr`'s use counts next to its object. ##### Example void test() { // OK: but repetitive; and separate allocations for the Bar and shared_ptr's use count - shared_ptr p {new{7}}; + shared_ptr p {new Bar{7}}; auto q = make_shared(7); // Better: no repetition of Bar; one object }