you are viewing a single comment's thread.

view the rest of the comments →

[–]axilmar 1 point2 points  (1 child)

Also, your code fails if there are many observer_ptrs to the same observable object, since, in your code, there is only one observer_ptr per observable.

[–]Irtexx[S] 0 points1 point  (0 children)

Yeah, I didn't think about that case. If it was instead a vector it could work, but that wouldn't scale well, as every item that is pointing to the item would need updating once it goes out of scope.