DM852 - Introduction to Generic Programming¶
Note
This is the 2016 version of the course.
Schedule¶
Tuesdays 12:15 – 14:00, IMADAs seminar room
Some Thursdays (see below) 16:15 – 18:00, IMADAs seminar room or U17
Week |
Day |
Notes |
Material |
---|---|---|---|
36 |
Tuesday |
Intro, tools, [BS] Ch. 22, 2–4, most of 8, 9.5 |
|
Thursday |
[BS] Ch. 9, part of 17 |
||
37 |
Tuesday |
[DA], [BS] Ch. 5, 14.3, part of 18 |
|
38 |
Tuesday |
[BS:10], [BS] Part of ch. 17 and 18 |
|
Thursday |
[BS] Part of ch. 19, beginning of ch. 20 |
||
39 |
Tuesday |
[BS] Part of ch. 20 |
|
40 |
Tuesday |
[BS] Part of ch. 20 and 21 |
|
41 |
Tuesday |
See also [AOD] and [SM] |
|
Thursday |
(U17) (Partial) template specialization |
||
42 |
Fall break |
||
43 |
No lectures |
||
44 |
Tuesday |
Tag dispatching and more algorithms. |
|
45 |
Tuesday |
No lecture |
|
Thursday |
|
||
46 |
Tuesday |
More smart pointers (see also [HS]), and empty base optimisation (EBO). |
|
47 |
Tuesday |
Argument-depedent lookup (ADL) (see also [AK]), intrusive smart pointer, and initial graph library discussion. |
|
Thursday |
More on polymorphism (see also beginning of [CW]), static polymorphism with CRTP, Boost.Iterator. |
||
48 |
Tuesday |
SFINAE (see also [WB2] and [BF]). |
|
49 |
Tuesday |
Visitors for graph algorithms (see also [BGL]). |
|
50 |
Tuesday |
Language support for concepts: Concepts TS [AS] (see also [CPP] and [AS2]). |
|
51 |
Tuesday |
Projects¶
Mandatory Assignment
Exam Project
Literature¶
- [BS] Programming: Principles and Practice Using C++, Second EditionAuthor: Bjarne StroustrupISBN-10: 0321992784ISBN-13: 9780321992789
[DA] Exception-Safety in Generic Components, David Abrahams, 2001
[BS:10] “New” Value Terminology, Bjarne Stroustrup, 2010
[AS] Generic Programming with Concepts Lite (Part I, Part II, Slides), Andrew Sutton, 2014.
Additional Resources¶
Language reference: C++ reference
Online Compiler Explorer
- Utility programs:
c++-filt
: demangle symbolsnm
: list symbols from compiled files (e.g.,.o
,.a
,.so
, and executables). Usenm -C
to demangle the symbols, or equivalentlynm myFile | c++filt
.valgrind
: detect errors related to memory
[AOD] Lambdas from First Principles: A Whirlwind Tour of C++, Arthur O’Dwyer, 2015
[SM] Type Deduction and Why You Care, Scott Meyers, 2014
[WB] What C++ Programmers Need to Know about Header
<random>
, Walter E. Brown, 2016[HS] Leak-Freedom in C++… By Default, Herb Sutter, 2016.
[AK] A Personal Note About Argument-Dependent Lookup, Andrew Koenig, 2012.
[BGL] The Boost Graph library.
[BI] The Boost Iterator library.
[CW] On Understanding Types, Data Abstraction, and Polymorphism, Luca Cardelli and Peter Wegner, ACM Comput. Surv., 1985.
[BF] Notes on C++ SFINAE, Bartlomiej Filipek, 2016.
[WB2] Proposing Standard Library Support for the C++ Detection Idiom, Walter E. Brown, 2015.
[CPP] Constraints and Concepts,
[AS2] Concepts TS draft on Github. CPPReference.
Installing GCC 6¶
Ubuntu¶
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-6
From Source¶
(See also https://gcc.gnu.org/wiki/InstallingGCC)
Download and unpack the sources, e.g.:
wget ftp://gd.tuwien.ac.at/gnu/gcc/releases/gcc-6.2.0/gcc-6.2.0.tar.gz tar xzf gcc-6.2.0.tar.gz
Download prerequisites:
cd gcc-6.2.0 ./contrib/download_prerequisites
Configure, build, and install (see https://gcc.gnu.org/install/configure.html for information on the options), e.g.,:
mkdir build cd build ../configure --prefix=<where you want to install it> --program-suffix=-6 --disable-multilib make -j <number of threads to compile with> make install