4 ms·
For memory ownership, look no further than `std::unique_ptr`. With the features introduced in C++11, it is an elegant, inexpensive way to clearly and safely den
by BenFrantzDale 12y ago
For memory ownership, look no further than `std::unique_ptr`. With the features introduced in C++11, it is an elegant, inexpensive way to clearly and safely denote memory ownership and to have that memory cleaned up when it goes out of scope or handed off as you see for.
If you are ever using bare pointers instead of `unique_ptr` you are probably doing it wrong.
For more: http://herbsutter.com/2013/05/29/gotw-89-solution-smart-pointers/ http://herbsutter.com/2013/05/29/gotw-89-solution-smart-poin...