File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ What makes this one different from the other smart pointers:
126126void test ()
127127{
128128 // making a unique pointer
129- unique_ptr<Foo> foo_ptr = make_unique<Foo>(new Foo() );
129+ std:: unique_ptr<Foo> foo_ptr = std:: make_unique<Foo>();
130130
131131 // No need to delete, gets freed at end of scope
132132}
@@ -149,10 +149,10 @@ What makes this one different from the other smart pointers:
149149void test ()
150150{
151151 // making a shared pointer
152- shared_ptr<Foo> sp_1 = make_shared<Foo>(new Foo() );
152+ std:: shared_ptr<Foo> sp_1 = std:: make_shared<Foo>();
153153
154154 // sharing ownership
155- shared_ptr<int> sp_2 = sp_1;
155+ std:: shared_ptr<int> sp_2 = sp_1;
156156
157157 // get amount of shares
158158 int shares = sp_1.use_count() // there are now 2 shares
@@ -188,10 +188,10 @@ What makes this one different from the other smart pointers:
188188void test ()
189189{
190190 // making a shared pointer
191- shared_ptr<Foo> sp = make_shared<Foo>(new Foo() );
191+ std:: shared_ptr<Foo> sp = std:: make_shared<Foo>();
192192
193193 // sharing ownership but with weak pointer
194- weak_ptr<Foo> wp = sp;
194+ std:: weak_ptr<Foo> wp = sp;
195195
196196 // get amount of shares
197197 int shares = sp.use_count() // still 1, weak ptr didnt add a share
You can’t perform that action at this time.
0 commit comments