The flyweight is a well-known GoF design pattern.
Its intent is to minimize memory usage by reducing the number of instantiations of a given object.
I will show you how to implement a robust flyweight in C++, as well as a way to make it templatable for easy use with no boiler-plate.