Hide menu

TDDD38 Advanced Programming in C++

seminars

This page serves as the main page for all the relevant course material. The slides for each seminar is given together with relevant reading material, exercises, tools and other relevant things.

Slides

Note that the published slides have extra material compared to the lectures.

The slides are constantly being updated so they will generally be ready a few days before the actual seminar is given. If a PDF has been updated within the last 14 days, then it will be marked with (updated: <date>) where <date> is the date it was updated.


Intro lecture 

Introduction and course information: slides (lecture version)
Introduction to the course and some basics.

Reading material:

  • Pointers and dynamic memory
    This document serves as a thorough introduction to pointers and dynamic memory conceptually. Generally it is assumed that students are familiar with these concepts from before, but if you are not then this document is a great starting point for learning how it works.

Exercises:

Recommended reading:


Seminar 1 

Fundamentals I: slides (lecture version)
Fundamental concepts in C++ that are needed during the course.

Reading material:

  • Explicit type conversions
    During the seminar we cover implicit type conversion, but not its counter-part: explicit type conversion. Instead I will refer to this document for an introduction to the various ways we can do explicit type conversion.

Exercises:


Seminar 2 

Fundamentals II: slides (lecture version)
Pointers, References, value categories, classes/structs and operator overloading.

Exercises:

Recommended reading:

Useful tools:

  • cdecl.org - a tool that translates complicated type declarations into english!


Seminar 3 

Fundamentals III: slides (lecture version)
Lifetime, special member functions, value categories, inheritance, polymorphism, virtual functions, real-time type information (RTTI)

Exercises:


Seminar 4 

Templates I: slides (lecture version)
Function templates, nontype template parameters, explicit template specialization, template argument deduction, name lookup, overload resolution, compilation and linking, constexpr and auto.

Exercises:

C++-20 info:

Useful tools:

  • Compiler Explorer - a tool that lets you see the generated assembler of your code, useful to see what is actually generated from your templates (remember to add the -O2 flag).


Seminar 5 

Templates II: slides (lecture version)
Class templates, partial specializations, member function templates, variadic templates, variadic recursion, static_assert, type_traits, fold expressions, namespaces.

Exercises:


Seminar 6 

Templates III: slides (lecture version)
dependent names, template-template parameters, forwarding references, SFINAE, decltype, trailing return types, expression SFINAE

Examples:

  • sum.cc (SFINAE techniques with comments)

Reading material

  • Expression templates (Files: vector.cc, vector_crtp.cc)
    Templates can be used for many interesting things. In particular are they useful when writing libraries or general purpose code. But there can be some performance problems if we are not careful when designing objects that heavily rely on chaining operations together. In this document a very interesting design pattern/technique is introduced for dealing with these issues.

Exercises:


Seminar 7 

STL I: slides (lecture version)
Design principles of the standard template library, streams, stream flags, std::array, std::vector, std::list, std::forward_list and std::deque, cache locality, pointer invalidation

Exercises:


Seminar 8 

STL II: slides (lecture version)
Iterators, iterator categories, output iterators, associative containers, container adaptors, function objects, lambda expressions

Exercises:

Useful tools:

  • C++ Insights - a tool that reveals things that happen behind the scenes (demonstrates compiler magic).


Seminar 9 

STL III: slides (lecture version)
std::function, std::bind, std::mem_fn, iterator utility functions, reverse and const interators, stream iterators, algorithms, usages of std::copy, modifying algorithms, std::accumulate

Exercises:


Seminar 10 

Sum Types in C++: slides (lecture version)
unions, std::optional, std::variant, std::any, union-like structs, placement new, basic variant implementation, aliasing, strict aliasing rules, std::launder

On launder() - Nicolai Josuttis
Formal explanation of why std::launder is needed.

Exercises:


Seminar 11 

Introduction to C++20: slides (lecture version)
Introduction to the big four of C++20: Concepts, Ranges, Modules and Coroutines. This seminar primarily focuses on concepts and ranges.

Highly recommended links:

Learn more:


Exam lecture 

Latest exam
Walkthrough of the new exam format. General tips for the exam and discussion on how the exam is assessed.

Other slides


Seminar ???

Template Design Patterns
Static polymorphism, Bridge Pattern, Generic programming, Policy pattern, allocators, Multiple inheritance, diamond problem, virtual inheritance, mixins, traits, type_traits, iterator_traits, tag dispatching, constexpr if

Exercises:

Reading material:


Seminar ???

Dynamic Linking (Given by Filip Strömbäck)
What is dynamic linking? How does it work? What are the advantages and disadvantages with using dynamic linking?

Material
The code and all other material related to this lecture can be found here. This material cover the code that was used during the lecture, notes and also some slides for reference. If you have any questions you can E-mail filip.stromback@liu.se and he will happily answer your questions.


Seminar ???

The C++ ABI (Given by Filip Strömbäck)
What is an ABI, System V ABI, Microsoft ABI, different implementations of: object layout, function calls, parameter passing, return values, virtual function calls, vtables, exceptions

Material
The code and all other material related to this lecture can be found in this tar-archine. This material cover the code that will be used during the lecture, notes and also some slides for reference. If you have any questions you can E-mail filip.stromback@liu.se and he will happily answer your questions.


Seminar ???

Multithreading in C++ (updated with file references 2021-05-21 at 16:15, refresh the PDF-file)) (Given by Klas Arvidsson)
std::thread, std::mutex, promise and future, condition variables, packaged task, async, execution policy (multithreaded STL algorithms)

Examples:

  • The examples from the lecture can be found here.


Page responsible: Christoffer Holm
Last updated: 2024-03-07