Waterloo CS246 - Object-Oriented Software Development in C++
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.
Cards in this deck
(20 cards)Preview terms and definitions before starting your study session.
std::unique_ptr.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.std::unique_ptr?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.std::shared_ptr.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.std::shared_ptr?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.std::weak_ptr and why is it used?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.Related Flashcard Sets
Explore similar study materials created by the community
JLPT N2 - Upper-Intermediate Japanese Kanji, Grammar & Expressions
Master high-frequency JLPT N2 grammar patterns, critical reading transition words, and high-yield kanji compounds to boost your exam score.
CompTIA Network+ (N10-008) - Networking Fundamentals & Subnetting
Master key networking concepts, OSI layer troubleshooting, IPv4/IPv6 subnetting calculations, critical port numbers, and Wi-Fi standards for the CompTIA Network+ N10-008 exam.
HSK 4 - Intermediate Chinese Vocabulary & Grammar
Master HSK 4 Chinese with this comprehensive flashcard deck! Dive into essential vocabulary, advanced grammar patterns like 把 and 被, common idioms, and cultural nuances to confidently elevate your conversational and reading skills.
CompTIA Network+ (N10-008) - Networking Fundamentals & Protocols
Master essential networking protocols, topologies, cabling standards, and troubleshooting tools with this high-yield CompTIA Network+ (N10-008) flashcard deck. Perfect for IT professionals and exam candidates aiming for certification success.