Smart Pointers (C++)

Smart pointers are very useful feature of modern C++ programming model. They are defined in the std namespace in the <memory> header file. Let’s see the raw and smart pointer in action: [crayon-6145f71474faa911779751/] As we can see there is a clear advantage of using smart pointers instead of the raw ones. The standard library provide three smart pointer types which should be replacement for raw pointers as long as new code is developed: unique_ptr allows one and only one owner

Continue Reading
Skip to toolbar