Chapter 21
Practical Template Programming
This chapter introduces you to some practical template examples so you can see how they can be deployed in your game development projects. You’ll see how to implement a Singleton class that will allow you to create objects that can be accessed from anywhere in your code base. The Singleton pattern also ensures that you can only create a single instance of those classes.
You’ll then see how you can create an event broadcasting system. This system itself will not use templates, but we will be creating some friend functions that will be implemented using templates to ensure that the objects being passed as parameters are set up to listen for events. The event manager class will also use a template function ...
Get Learn C++ for Game Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.