Checkpoint: Inventory of owned items
Challenge on lesson: Checkpoint: Ownership Transfer
CHALLENGE
Difficulty: intermediate+25 XP
Complete Inventory managing std::vector<std::unique_ptr<Item>>: void add(std::unique_ptr<Item>) stores it; std::unique_ptr<Item> take(const std::string& name) finds the item, moves it out of the vector (ownership leaves the inventory), erases the now-empty slot, and returns it โ or returns nullptr when absent. Item (name-based) is partially given.
Press Submit to check your solution.
Back to lesson: Checkpoint: Ownership Transfer