A smart pointer is a container/wrapper for a raw pointer. In modern C++ smart pointers are defined in the std namespace in the memory header file.
One big advantage of smart pointers is that they are responsible for deleting the memory that they use, which means that they automatically deallocate the memory when they go out of scope.
There are three types of smart pointers in C++: unique pointer, shared pointer and weak pointer (std::unique_ptr, std::shared_ptr, std::weak_ptr)
📚 Learn how to solve problems and build projects with these Free E-Books ⬇️
C++ Lambdas e-book - free download here: https://bit.ly/freeCppE-Book
Entire Object-Pascal step-by-step guide - free download here: https://bit.ly/FreeObjectPascalEbook
🚀📈💻🔥 My Practical Programming Course: https://www.codebeautyacademy.com/
Experience the power of practical learning, gain career-ready skills, and start building real applications!
This is a step-by-step course designed to take you from beginner to expert in no time!
💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
Use it quickly, because it will be available for a limited time.
Contents:
00:00 - Intro
00:47 - What are smart pointers in C++
01:39 - Unique pointer in C++
04:10 - Sharing vs moving a unique pointer in C++
06:44 - Unique pointer automatic memory deallocation
11:42 - Shared pointers in C++
15:09 - Shared pointer automatic memory deallocation
18:42 - Weak pointer vs shared pointer in C++
How to install and use PVS-Studio - https://youtu.be/AeyTSLGIX1M
Object Oriented Programming - https://bit.ly/Cpp_OOP_Playlist
C++ Pointers - https://youtu.be/kiUGf_Z08RQ
Learn Exception handling - https://youtu.be/kjEhqgmEiWY
Tag me on you Instagram stories:
Instagram 📸 - https://www.instagram.com/TrueCodeBeauty
Twitter 🐦- https://twitter.com/TrueCodeBeauty