From feeb84eae778298803f1b6b95c0e6933ad471084 Mon Sep 17 00:00:00 2001 From: Jidong Xiao Date: Fri, 18 Apr 2025 03:41:08 -0400 Subject: [PATCH] adding unique ptr example --- lectures/27_garbage_collection/README.md | 2 +- lectures/27_garbage_collection/unique_ptr1.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lectures/27_garbage_collection/README.md b/lectures/27_garbage_collection/README.md index dfccb62..5a1af22 100644 --- a/lectures/27_garbage_collection/README.md +++ b/lectures/27_garbage_collection/README.md @@ -401,7 +401,7 @@ int main(){ std::unique_ptr s2(std::move(s1)); - // Question: which of the following line will trigger a seg fault? + // Question: which one of the following two lines will trigger a seg fault? // std::cout << "s1:" << *s1 << std::endl; // std::cout << "s2:" << *s2 << std::endl; diff --git a/lectures/27_garbage_collection/unique_ptr1.cpp b/lectures/27_garbage_collection/unique_ptr1.cpp index 0997db7..c9083d5 100644 --- a/lectures/27_garbage_collection/unique_ptr1.cpp +++ b/lectures/27_garbage_collection/unique_ptr1.cpp @@ -13,7 +13,7 @@ int main(){ std::unique_ptr s2(std::move(s1)); - // Question: which of the following line will trigger a seg fault? + // Question: which one of the following two lines will trigger a seg fault? // std::cout << "s1:" << *s1 << std::endl; // std::cout << "s2:" << *s2 << std::endl;