Smart Pointers in C++: Raw vs Unique Pointers

preview_player
Показать описание
In this video I demonstrate that, unlike a raw pointer, when using a smart pointer the destructor is called when the pointer goes out of scope.

0:33 - Writing a function that returns an object pointer
0:50 - Writing a function that returns a unique pointer
1:26 - A raw pointer to an object
2:40 - A unique pointer to an object
Рекомендации по теме
Комментарии
Автор

Oh well that's simple. I always thought smart pointers somehow had way more implications but that's basically just a way how you can automate memory management similiar to something like C#'s Garbage Collector... Wow. I imagined them to be more interesting. Thanks for the vid! :D

actualrave
Автор

JESUS FUCKING CRIST, THAT SIMPLE. I GOT A PROFESSOR TAKE 5 HOURS TO EXPLAIN AND NO ONE UNDERSTAND.

THANK YOU MY GOOD LAD!

abcdefghijmnopqtstuvxz
visit shbcf.ru