Intermediate C++ Game Programming Tutorial 21
From Chilipedia
Smart pointers. I know pointers, I have the smartest pointers. In this video we learn about std::unique_ptr<>
, which is by far the most frequently-used and important smart pointer. std::shared_ptr<>
can go suck on an egg.
Topics Covered
-
std::unique_ptr<>
- How to pass (and not to pass) smart pointers
- Custom deleters
Video Timestamp Index
Bonus Video
Coming soon (Surface final form)!
Notes
Although Chili uses std::unique_ptr<>
in Surface
, which allows us to = default
the move members and leave the destructor undeclared, the astute student will realize that Surface
should actually be setting the width
and height
of the donor surface to 0
when pilfering, so we actually still need to declare move members in this case. This is done in the Bonus Video where we perfect Surface
.
Source Code