Generic Programming


Zoltan Porkolab, Eötvös Lorand University Budapest


2-stündige geblockte KV,
anrechenbar unter "Spezielle Kapitel aus Softwareentwicklung" im Informatik-Studienplan.
Die Lehrveranstaltung wird auf Englisch gehalten und und besteht je zur Hälfte aus einem Vorlesungsteil und aus einem Projekt.


Datum: Uhrzeit: Raum:
Montag, 24.3.2003 16:15-18:45 T 857
Dienstag, 25.3.2003 16:15-18:45 HS 14
Mittwoch, 26.3.2003 16:15-18:45 T 212
Donnerstag, 27.3.2003 16:15-18:45 T 857
Freitag, 28.3.2003 16:15-18:45 T 857


Generic Programming (GP) - greatly popularized by the C++ Standard Template Library (STL) of container data structures and generic algoritms - is a programming paradigm which become more and more popular in the generative programming community. The goal of GP is to express algorithms and data structures in a broadly adaptable, interoperable form that allows their direct use in software construction.

In this seminar first we will learn the technical foundations of GP. Then we examine the usage of GP and connected technologies: static metaprogramming, expression templates, mixins, traits, typelists, etc. We will show that the concept of GP is not restricted to the usage of C++ language, but applicable in other languages too.

Solid C++ knowledge is useful but not indispensable for this course.

Schedule for the five days

  1. Technical foundations: Generic technologies in modern programming languages. C++ template techniques, template specializations. Java generics. Generics in functional languages.

  2. Technical foundations: Metaprogramming. The Turing-completeness of C++ templates. Template metaprogramming and expression templates. Expression templates in Java.

  3. Generic Programming: Concept of STL, Containers, Iterators, Algorithms. Adaptors, Functors, Binders. Smart iterators. Alternative Generic Libraries.

  4. Polymorphism: inclusion vs. parametric. Traits classes, pro's and contra's. Static interfaces/Concept checking. Multiparadigm programming.

  5. Policy classes, Typelists, The LOKI library An example for solving complex inheritance family problems.


  • Krzysztof Czarnecki, Ulrich Eisenecker: Generative Programming: Methods, Tools, and Applications
    Addison-Wesley, 2000, ISBN: 0201309777
    This is the most fundamental book on Generative Programming

  • Nicolai M. Josuttis: The C++ Standard Library: A Tutorial and Reference
    Addison-Wesley, 1999, ISBN: 0201379260
    This includes a good introduction to STL concepts. (Perhaps the best book on the C++ standard library.)

  • Matthew H. Austern: Generic Programming and the STL: Using and Extending the C++ Standard Template Library
    Addison-Wesley, 1998, ISBN: 0201309564
    How to use and extend STL.

  • Andrei Alexandrescu: Modern C++ Design: Generic Programming and Design Patterns Applied
    Addison Wesley, 2001, ISBN: 0201704315
    This is a real magic :-)

  • James O. Coplien: Multi-Paradigm Design for C++
    Addison-Wesley, 1998, ISBN: 0201824671
    A more theoretical book on the topic.

  • Todd Verhuisen's page with many related topics: