In game development, C++ enums are often used to denote that certain values can be combined using bitwise-operations, resulting in so-called flags. However, enums in pre-C++0x exhibit some drawbacks which will be discussed and improved upon in this post.
In the last installment of the memory system series, we covered how new, delete, and their variants work. This time, we’re going to build our own little toolset which allows us to create new instances (or arrays of instances) of any type using custom allocator classes in a standards-compliant way. Be prepared for some function templates, type-based dispatching, template magic, and nifty macros.