By Mike Shah, presented at Core C++ 2022.
Pointers are one of the most powerful tools in the C++ language available to programmers. Pointers allow sharing of resources, and for programmers to take control of the lifetime of their objects. However-- 'with great power comes great responsibility'. In this talk I am going to begin with how programmers can 'wrap' a raw pointer in a class to create a smart pointer that takes advantage of RAII to reclaim resources. I will then introduce in the standard library each of unique_ptr, shared_ptr, and weak_ptr. Beginners who have never seen these before will leave with concrete advice on where to use each of the following and for what scenarios where they previously had used raw pointers. Finally, at the end of the talk, I will give a brief insight into Smart pointer adaptors in C++23 (out_ptr_t, out_ptr, inout_ptr_t, and inout_ptr).
-----
Mike Shah is an Associate Teaching Professor at Northeastern University in the Khoury College of Computer Sciences. His primary teaching interests are in computer systems, computer graphics, and software engineering. His research interests are related to performance engineering (dynamic analysis), software visualization, and computer graphics. Along with teaching and research work, he have juggled occasional consulting work as a 3D Senior Graphics Engineer in C++.