Shared Pointer In C++

JOIN ME ————— YouTube 🎬    / @cppnuts   Patreon 🚀   / cppnuts   COMPLETE PLAYLIST ———————————— C++ Tutorial For Beginners :    • Introduction To C++   STL (Standard Template Library) :    • STL In C++   ThreadIng In C++ :    • Multithreading In C++   Data Structures:    • Data Structure   Algorithms:    • Binary Search   Design Patterns:    • Factory Design Pattern in C++   Smart Pointers:    • Smart Pointer In C++   C++14:    • Digit Separator In C++   C++17:    • std string_view in C++17 | Fastest String ...   C++ All Type Casts:    • static_cast In C++   INTERVIEW PLAYLIST ———————————— C++ Interview Q&A:    • Structural Padding & Packing In C & C++   C++ Interview Q&A For Experienced:    • How delete[] Knows How Much  To Deallocate...   Linked List Interview Questions:    • Find Kth Node From Back In Singly Linked List   BST Interview Questions:    • Search Element In Binary Search Tree (BST)   Array Interview Questions:    • Reverse An Array   String Interview Questions:    • Check String Is Palindrome Or Not   Bit Manipulation Questions:    • Find Set Bit In Integer Number   Binary Tree Interview Question:    • Invert Binary Tree   Sorting Algorithms:    • Bubble Sort   C++ MCQ:    • Video   C MCQ:    • What printf returns after printing? | C Pr...   C Interview Questions:    • Designated Initialization In C   QUICK SHORT VIDEOS ————————————- C++ Short :    • C++ Short Videos   C Short :    • Shorts C Programming MCQ   DESCRIPTION: In this video we will learn about shared pointer in smart pointer series in c++. There are few points about it: 0. shared_ptr is a smart pointer which can share the ownership of object (managed object). 1. Several shared_ptr can point to the same object (managed object). 2. It keep a reference count to maintain how many shared_ptr are pointing to the same object. and once last shared_ptr goes out of scope then the managed object gets deleted. 3. shared_ptr is threads safe and not thread safe. [what is this??] a. control block is thread safe b. managed object is not 4. There are three ways shared_ptr will destroyed managed object. a. If the last shared_ptr goes out of scope. b. If you initialise shared_ptr with some other shared_ptr. c. If you reset shared_ptr. 5. Reference count doesn't work when we use reference or pointer of shared_ptr. #stl #cpp #programming #tutorial #interviewquestions #softwareengineering #computerscience