Why doesn't UE utilize STL containers?

The Unreal Engine’s avoidance of the C++ standard library’s containers is primarily historical. C++ was standardized in 1998, the same year we shipped the first Unreal Engine game.

Back then, the standard libraries were controversial, poorly-implemented, and very inconsistent between platforms. They made very aggressive use of new C++ features that hadn’t yet been production-proven, and had some significant problems interoperating with C libraries. For example, std::vector wasn’t guaranteed to be contiguous, so passing an array to a C library like DirectX could potentially involve creating a temporary copy of it.

The standard containers are very stable now, and I don’t think it would be too hard to compatibly evolve UE4 to use them if we chose to, through some #define’s and implementations of the existing TArray and TMap operations that could be deprecated over time.

10 Likes