Professionals out there,
this is the first time that I'm actually posting a question to this board that helped me out a lot in the past. I'm still a programming novice and have been trying to learn a lot about programming & software development in the last few months.
I recently tackled the topic "c++11-Smart Pointers" and decided rewrite all the Design Patterns I learned a few weeks earlier, including the"Observer Pattern" using shared_ptr & weak_ptr for resource management.
When I was trying to write a simple Implementation of the observer pattern (like in Head First's Design Pattern or Design Patterns by E.Gamma), using an interface-class for both the observable subjects and the observers, and exactly one concrete class for each, I received various error messages from Visual Studio. I just don't understand how to combine shared_ptr and weak_ptr in this pattern, which might be due to the fact that I still don't fully understand the the combination of both.
Unfortunatelly, even a thorough search on the Internet didn't provide me with a simple example of an "observer-pattern using smart-pointer" that can serve as a orientation for me.
I therefore was wondering, if one of you guys would know where to find such a simple implmentation or be so kind to provide me with one of your own. Both would be really really helpful :-)
Thanks a lot
coderAndi