C++ Language/Indirection/SmartPointers/UniqueOwnership

From Wikibooks, open books for an open world
Jump to navigation Jump to search

If a smart pointer's memory should be "owned" by exactly one client, use std::unique_ptr<> for the smart pointer type.

Additional information about unique_ptr (includes interactive examples)