C++ STL for Games

For the memory allocation issues, many people don’t know this but you can write custom allocators for your STL container classes. Allocators are basically policy classes you pass into your templates to determine how allocations are performed. Using these you can usually work around whatever memory issues are problematic on your platform of choice.

Of course, if you’re using the STL and doing dumb things like maps of strings to large, non-pointer types, then you have bigger problems on your hand.

The default STL has a fair number of issues that make it difficult to use with games, especially when it comes to memory alignment.

A customized variant such as the EA STL is specially designed for games and can get you much better memory performance and console usability. I haven’t seen an open source gaming STL variant, but it would not be impossible to replace piecemeal the important bits.

Advertisements