October 1991

C++ gains templates

AT&T's Cfront 3.0 release was the first C++ compiler to support templates, enabling generic programming in production code.

What it was for

C++Templates let you write one piece of code that works with many types — a single `sort()` for integers and strings, or one `vector` class instead of separate `IntVector` and `StringVector` copies. This idea became the foundation for C++'s standard library (`vector`, `map`, `sort`).

Why it's here

Before templates, C++ libraries were either copy-pasted for every data type or written with unsafe void pointers. Templates made reusable, type-safe libraries practical.

Why it mattered

Developers could ship one generic containerAn isolated runtime environment packaging an app and its dependencies — lighter than full virtual machines. or algorithm and reuse it across their whole codebase — with no runtime performance penalty.

What it solved

Every time you needed a list of a new type, you rewrote the same linked-list or sort logic from scratch. Templates let you write it once and instantiate it for any type.

Media

  • C++
    ImageC++

    Jeremy Kratz, Public domain, via Wikimedia Commons

Related