Practice · 2 of 2
weak_ptr observer pattern
CHALLENGE
Difficulty: intermediate+25 XP
Complete Event: void subscribe(std::weak_ptr<void> w) stores the watcher, and int fire() counts watchers whose object is still alive, pruning expired ones from the list. This is the classic observer pattern that does NOT keep observers alive.
Press Submit to check your solution.
Back to lesson: Practice: unique_ptr practice