Term
Definition
Master modern C++ and software engineering with this high-yield flashcard deck for Waterloo CS246. Dive deep into RAII, smart pointers, OOP principles, and essential design patterns like Observer, Factory, Decorator, and MVC.
A quick, read-only look at the deck content.
Term
Definition
Term
Definition
Term
Definition
Term
std::unique_ptr.Definition
std::unique_ptr is a smart pointer that owns and manages a dynamically allocated object. It enforces exclusive ownership, meaning only one unique_ptr can point to a resource at a time. It cannot be copied, only moved, ensuring the resource is deleted exactly once when the unique_ptr goes out of scope.Term
std::unique_ptr?Definition
std::unique_ptr when you need exclusive ownership of a dynamically allocated object, and the object's lifetime is tied to the unique_ptr's scope. It's ideal for local variables, function returns, or as a member of a class where the class exclusively owns the resource.Term
std::shared_ptr.Definition
std::shared_ptr is a smart pointer that manages a dynamically allocated object using shared ownership. Multiple shared_ptr instances can point to the same resource. It uses a reference count to track the number of owners; the resource is deallocated when the last shared_ptr owning it is destroyed.Term
std::shared_ptr?Definition
std::shared_ptr when multiple objects need to share ownership of a single dynamically allocated resource, and the resource should only be deallocated when all owners are gone. This is common in scenarios like caching or graph structures where multiple nodes might refer to the same object.Term
std::weak_ptr and why is it used?Definition
std::weak_ptr is a non-owning smart pointer that observes a std::shared_ptr without affecting its reference count. It's primarily used to break circular references between std::shared_ptr objects, which would otherwise lead to memory leaks. To access the managed object, a weak_ptr must first be converted to a shared_ptr using its lock() method.Explore similar study materials created by the community
Master B1 German with this high-yield flashcard deck, covering complex sentence structures, Konjunktiv II, N-Deklination, two-way prepositions, and essential vocabulary to express ideas fluently.
Master central nervous system pathways, electrophysiology equations, neurotransmitter signaling, and cranial nerve functions with these high-yield medical flashcards.
Master essential French for daily life and travel with this comprehensive A1/A2 flashcard deck. Learn high-frequency vocabulary, core grammar rules, and key verb conjugations to build foundational fluency.
Master Kubernetes orchestration and cloud-native deployment with this high-yield flashcard deck. Dive into core primitives, networking, storage, and essential `kubectl` commands to confidently manage containerized applications.