Skip to main content

Ambroisie's blog

Tag: design pattern

Generic Flyweight in C++

The flyweight is a well-known GoF design pattern.

It’s 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.