The observer pattern is a popular and necessary pattern, so it is surprising that, unlike other languages (e.g., C#), neither C++ nor the Standard Library come with a ready-to-use implementation. Nonetheless, a safe, properly implemented observer (if there can be such a thing) is a technically sophisticated construct, so in this chapter we’ll investigate it with all its gory details.
People get old. It’s a fact of life. But when someone gets older by a year we might want to congratulate them on their birthday. But how? Given a definition such as:
1 struct Person ...