std::shared_ptr - A reference counted smart pointer | Modern Cpp Series Ep. 34

  Рет қаралды 7,156

Mike Shah

Mike Shah

Күн бұрын

►Full C++ Series Playlist: • The C++ Programming La...
►Find full courses on: courses.mshah.io/
►Join as Member to Support the channel: / @mikeshah
►Lesson Description: In this lesson I show you how to use a std::shared_ptr. Shared pointers are the second of three types of smart pointers introduced in C++. They are a wrapper around raw pointers, that allow you to ensure that a resource stays alive while an object points to it. The mechanism for this is by using reference counting, and a special 'control block' does the book keeping for your smart pointers.
►KZfaq Channel: / mikeshah
►Please like and subscribe to help the channel!

Пікірлер: 26
@emiliyanrizov4566
@emiliyanrizov4566 2 жыл бұрын
That was definitely a nice explanation. Didn't even realize that the video has only 260 views. You definitely deserve way more. The video quality is nice and the way you present the material is also great.
@MikeShah
@MikeShah 2 жыл бұрын
Thank you for the kind words! :)
@grawlixes
@grawlixes 2 ай бұрын
experiencced dev starting a C++ journey here. managining memory/avoiding memory leaks is the number one thing I'm studying right now and your vids have been really helpful. thanks!
@MikeShah
@MikeShah 2 ай бұрын
Cheers, happy to hear that 😁
@mustafaaltay4920
@mustafaaltay4920 Жыл бұрын
concise and beneficial video with practice
@MikeShah
@MikeShah Жыл бұрын
Thank you for the kind words!
@minteligencia
@minteligencia 3 ай бұрын
Very helpful. thanks!
@MikeShah
@MikeShah 3 ай бұрын
You are most welcome!
@Himshu143
@Himshu143 11 күн бұрын
Thanks 🙏🙏
@MikeShah
@MikeShah 11 күн бұрын
Cheers!
@Yuvaraj-pd6ng
@Yuvaraj-pd6ng 2 ай бұрын
ptr2 constructor will be called once its scope is ended but the static variable count !=1 , so ptr2==NULL if count==1 then delete memory right?
@reptilicusrex4748
@reptilicusrex4748 Жыл бұрын
Yet another excellent explainer video by Dr. Shah.
@MikeShah
@MikeShah Жыл бұрын
Cheers!
@ieduardoms
@ieduardoms Жыл бұрын
Thank you very much, this video has helped me to better understand Boost Asio.
@MikeShah
@MikeShah Жыл бұрын
Cheers, thank you for the kind words!
@dhanushs1802
@dhanushs1802 Жыл бұрын
Great video. Very neatly explained as always. Thank you. Do you have any video about threads and process or any resources that you suggest?
@MikeShah
@MikeShah Жыл бұрын
I have a concurrency series here: kzfaq.info/sun/PLvv0ScY6vfd_ocTP2ZLicgqKnvq50OCXM
@caiyu538
@caiyu538 6 ай бұрын
👍
@VoidloniXaarii
@VoidloniXaarii Жыл бұрын
This vid was soooooo guuuut ❤❤❤❤
@MikeShah
@MikeShah Жыл бұрын
Cheers!
@joebosah2727
@joebosah2727 Жыл бұрын
This is my nth time (5
@MikeShah
@MikeShah Жыл бұрын
Cheers Joe!
@ijyotir
@ijyotir Жыл бұрын
What are the use case of Raw pointer that cannot be achieved by shared pointer ?
@MikeShah
@MikeShah Жыл бұрын
Interfacing with a C API is the one case, though you can make a decision on what pointer to use. Otherwise internally in data structures to avoid any overhead I use might use raw pointers.
@ijyotir
@ijyotir Жыл бұрын
@@MikeShah Thanks and Wish you a Very happy and healthy new year 2023 .
@MikeShah
@MikeShah Жыл бұрын
@@ijyotir Cheers! Same to you!
Китайка и Пчелка 4 серия😂😆
00:19
KITAYKA
Рет қаралды 3,6 МЛН
Заметили?
00:11
Double Bubble
Рет қаралды 3,5 МЛН
Они убрались очень быстро!
00:40
Аришнев
Рет қаралды 2,9 МЛН
unique_ptr: C++'s simplest smart pointer
11:54
mCoding
Рет қаралды 40 М.
Smart Pointers in C++ (Stop Using new?)
17:18
Caleb Curry
Рет қаралды 10 М.
are "smart pointers" actually smart?
9:44
Low Level Learning
Рет қаралды 69 М.
31 nooby C++ habits you need to ditch
16:18
mCoding
Рет қаралды 725 М.
How To Unlock Your iphone With Your Voice
0:34
요루퐁 yorupong
Рет қаралды 21 МЛН
Где раздвижные смартфоны ?
0:49
Не шарю!
Рет қаралды 819 М.
Samsung S24 Ultra professional shooting kit #shorts
0:12
Photographer Army
Рет қаралды 12 МЛН
📦Он вам не медведь! Обзор FlyingBear S1
18:26