Tag: unique_ptr
5 posts
-
C++ shared_ptr vs unique_ptr: Smart Pointer Choice Complete Guide
shared_ptr vs unique_ptr: prefer unique_ptr by default; use shared_ptr for shared ownership. Reference counting cost, weak_ptr for cycles, and performance-minded patterns.
-
[2026] C++ Init-Capture — C++14 [x = expr], 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 Patterns
C++ smart pointers explained: unique_ptr for exclusive ownership, shared_ptr for shared ownership, weak_ptr for cycles—examples, make_unique/make_shared...
-
[2026] C++ Smart Pointers | Fixing a Circular Reference Bug That Took Three Days
C++ smart pointers: unique_ptr, shared_ptr, weak_ptr, make_unique, make_shared—fix circular references when memory grows despite no Valgrind leak.