Generic Programming

Author: Juha Kärkkäinen
Organization: University of Helsinki
Event:5th Estonian Summer School in Computer and Systems Science (ESSCaSS'06)
Date: 6-10 August 2006
Place:Pedase, Estonia


Generic programmin is a programming paradigm that aims at implementing algorithms and data structures in as abstract and general way as is possible without a loss of efficiency. This makes it a particularly suitable approach for implementing libraries of algorithms and data structures. The prime example is the Standard Template Library (STL), which is part of the C++ standard library. This course introduces the central ideas of generic programming using STL as the main example.


  1. Introduction
  1. Data Abstraction - STL Iterators
  1. Concepts - Iterator Categories
  1. Metaprogramming - Iterator Traits
  1. Functors
  1. Other Libraries



  • STL handbook with very good introduction to generic programming
  • Bjarne Stroustrup. The C++ Programming Language. 3rd edition, Addison-Wesley, 1997.
  • Nicolai M. Josuttis. The C++ Standard Library - A Tutorial and Reference. Addison-Wesley, 1999.
  • David Vandevoorde and Nicolai M. Josuttis: C++ Templates: The Complete Guide. Addison-Wesley, 2003.
  • Krzysztof Czarnecki and Ulrich W. Eisenecker. Generative Programming: Methods, Tools, and Applications. Addison-Wesley, 2000.
    • next step from generic programming
    • design methods for algorithm libraries
  • David Abrahams and Alex Gurtovoy. C++ Template Metaprogramming. Addison-Wesley, 2005.