Tag: unique_ptr
5 posts
-
C++ shared_ptr vs unique_ptr: Smart Pointer Choice Complete
shared_ptr vs unique_ptr: prefer unique_ptr by default; use shared_ptr for shared ownership. Raw pointers in C++ do not communicate ownership.
-
C++ Init-Capture — C++14 , Move, and unique_ptr Patterns
C++11 capture vs C++14 init-capture ([x=expr]): move semantics, unique_ptr, async patterns, and common lifetime mistakes with lambdas.
-
C++ RAII & Smart Pointers: Ownership and Automatic Cleanup
RAII in C++: acquire resources in constructors, release in destructors—plus unique_ptr, shared_ptr, weak_ptr, patterns, and common pitfalls with examples.
-
C++ Smart Pointers: unique_ptr, shared_ptr & Memory-Safe
C++ smart pointers explained: unique_ptr for exclusive ownership, shared_ptr for shared ownership, weak_ptr for cycles—examples, make_unique/make_shared...
-
C++ Smart Pointers
C++ smart pointers: unique_ptr, shared_ptr, weak_ptr, make_unique, make_shared—fix circular references when memory grows despite no Valgrind leak.