From 235d604757b635af5d5752fd5459db03c8b359e6 Mon Sep 17 00:00:00 2001 From: neingeist Date: Sat, 19 Apr 2014 11:12:28 +0200 Subject: [PATCH] print out function name when called --- shared_ptr.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shared_ptr.cpp b/shared_ptr.cpp index f2d28b5..35f0056 100644 --- a/shared_ptr.cpp +++ b/shared_ptr.cpp @@ -6,6 +6,8 @@ // From Wikipedia. void shared_ptr() { + std::cout << __FUNCTION__ << std::endl; + std::shared_ptr p1(new int(5)); std::shared_ptr p2 = p1; // Both now own the memory. assert(p1.use_count() == 2); @@ -24,6 +26,8 @@ void shared_ptr() { } void shared_ptr_container() { + std::cout << __FUNCTION__ << std::endl; + std::shared_ptr p1(new int(5)); std::shared_ptr p2 = p1; // Both now own the memory. assert(p1.use_count() == 2); @@ -42,6 +46,8 @@ void shared_ptr_container() { } void weak_ptr() { + std::cout << __FUNCTION__ << std::endl; + std::shared_ptr p1(new int(5)); std::weak_ptr wp1 = p1; // p1 owns the memory.