The C++ Standard Template Library

The Standard Template Library, or STL, is a part of the Standard C++ runtime library. It provides template-based standard containers and algorithms. As part of the C++ Standard, it is currently (2001) available for almost all C++ compilers, and provides a standard, type-safe, efficient, and well designed interface for common data structures and algorithms.

The most important feature of STL is that it provides useful abstraction without performance penalties. It does this by using templates for compile-time polymorphism rather than run-time polymorphism (although run-time polymorphism works seamlessly with the STL as well.)

Usually a version of the STL is included with your compiler. If that's not the case, or if you want to get an improved version, it is usually fairly easy to upgrade as the STL consists of header files.

Downloadable STL Libraries - This company is the source of the (old) STL library that comes with Visual C++; this site has some patches for 5.0 and 6.0 users. It also sells a modern Standard C++ library which works with VC++, and if you are doing serious development work with STL, it might well be worth the investment. There is also an online reference at this site. - This is a freely available implementation of STL by some of the originators (in particular, Alex Stepanov).  This is the library that GNU/Cygnus g++ uses. It also has a list of useful references to other STL sites and an online reference manual. I use this library to build Unix servers using g++ on Solaris. - STLPort is a "portable STL library" based on the SGI STL mentioned above. It adds support for additional platforms and compilers, and a debug mode to catch incorrect usage of the library. I have used STLPort 4.0 this with VC++ 6.0 as a replacement for the outdated VC++ library; it works very well. Setting it up requires a few changes to your VC project settings.

Other STL Resources - Provides free, peer reviewed C++ libraries designed to extend the Standard C++ Library and STL in particular.

VTL (View Template Library) Homepage - A layer on top of STL that provides "virtual containers".

Amit's Tradeoffs: Sorting in C++ vs. C - Benchmarking STL & C++ vs. straight C. C++ and STL win both in development speed and run time.

A VC++ Error Message Decryptor - A utility that plugs in to VC++ to turn its template-related error messages into something understandable. (Why can't Microsoft build this into their compiler?)

Generic Programming

Generic: Mappings between Types and Values - A way to achieve reflection within C++ using template metaprogramming.

Using Traits - Explanation of the traits technique in generic programming.


C++ Compiler Comparison Chart - Check your compiler for conformance with the C++ Standard.

The ADAPTIVE Communication Environment (ACE) - A C++ network programming library that uses templates extensively.

Test Drive Comeau C++ Online - Try out a high-quality C++ compiler for free over the web (a good way to check if your compiler is broken)

Stroustrup: Bjarne's Homepage - Useful background information on C++ and its multiparadigm nature.