Abstract
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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
C# has explicitly solved this problem twice in successive releases. First, it introduced an attribute called [CallerMemberName] that inserted the name of calling function/property as the string value of a parameter. A second release simply introduced nameof(Foo), which would take the name of a symbol and turn it into a string.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2018 Dmitri Nesteruk
About this chapter
Cite this chapter
Nesteruk, D. (2018). Observer. In: Design Patterns in Modern C++. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-3603-1_20
Download citation
DOI: https://doi.org/10.1007/978-1-4842-3603-1_20
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-3602-4
Online ISBN: 978-1-4842-3603-1
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books