24_Observer - Decoupling state synchronization in C++ #5
MarioGalindoQ
started this conversation in
III. Behavioral Patterns
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Overview
The Observer Pattern is a classic way to implement a one-to-many dependency. In this repository, I've implemented a thread-safe version where subjects can notify multiple observers of state changes.
Discussion points
I’m curious about your approach to these common challenges:
detachmethod. Have you tried usingstd::weak_ptrto handle this automatically?notify()method enough, or do you prefer passing specific "Event" objects to the observers?How do you manage the lifecycle of your observers? Let's discuss! ⚙️
Beta Was this translation helpful? Give feedback.
All reactions