Hide menu

TDDD38 Advanced Programming in C++

Useful links

Basic C++


Make Simple Tasks Simple!
Stroustrup on working in modern C++ (keynote CppCon 2014). Actual presentation starts at minute 7.
22:30: a good example of why we want to simplify code
Writing good C++14
Stroustrup, keynote at cppcon 15. A short overview of the state of the language and an introduction on the Cpp Core Guidelines and the GSL (guideline support library)
Cpp Core Guidelines
The aim is to help people to use modern C++ effectively. By "modern C++" we mean C++11 and C++14 (and soon C++17). In other words, what would you like your code to look like in 5 years' time, given that you can start now? In 10 years' time?
Cpp Core Guidelines - parameter passing
Recommendations on how to pass arguments and return results
Simplify C++ - Simple and Clean Code vs. Performance
Performance and simplicity don't always contradict each other!
Simplify C++ - New C++ features - auto for variables
A short and good introduction for using auto for variable declarations
Almost always auto
Herb Sutter - his view on using auto
[SO] When should static_cast, dynamic_cast, const_cast and reinterpret_cast be used?
A good description on the types of type conversions in C++ (and why you shouldn't use C-style casts)
[SO] Why should C++ programmers minimize use of 'new'?
An overview of the C++ memory model
[SO] Why is iostream::eof inside a loop condition considered wrong
Using good (as in working) style for input operations
[SO] What is the difference between a definition and a declaration?
A simple introduction to the difference between definitions and declarations.
[PS] Are data type declarators like int and char stored in RAM when a C program executes?
Not really C++-specific, but a short overview of how data is stored
[SO] What are the evaluation order guarantees introduced by C++17?
We will (finally) have defined evaluation order in more places
Understanding the meaning of lvalues and rvalues in C++
A ground-up discussion on lvalues and rvalues (value categories) with lots of examples
Building Intuition on Value Categories
Another take on value categories

Classes and operators


Simplify C++: C++ is NOT an object-oriented language
Sure, we support OO, but that doesn't make it an OO language.
ISO C++ FAQ: Additions regarding classes in C++11
Simplify C++: Modern C++ features - Inheriting and delegating constructors
Having constructors calling other constructors
Simplify C++: Modern C++ features - Default initializers for member variables
If you only want to set default values in your constructor, let the compiler do it!
Simplify C++: Fun with(out) keyword explicit
A type converting function may give you alot of unforseen errors without explicit declarations.
ISO C++ FAQ: Guidelines for operator overloading
Some rules of thumb for operator overloading for your own classes
Simplify C++ - R-value references and move semantics
SO: What are Aggregates and PODs and how/why are they special?
The first answer is a great overview of POD and aggregates
cppreference: RAII
A short introduction to RAII
Stroustrup: Why RAII
A short example on RAII
/r/cpp: Can I always depend on return value optimization as part of the standard, or do I need to think about it more?
A good thread about (N)RVO vs. move semantics and their interplay
Effective Modern C++, Item 17: Understand special member function generation
A good discussion on when and why a member function is generated

Polymorphism and Inheritance


Simplify C++: Levels of exception safety
On why you should think about exception safety levels
Simplify C++: Modern C++ Features - override and final
Why you should use the new "keywords" (identifiers with special meaning) override and final
Simplify C++: Modern C++ Features - keyword `noexcept`
The noexcept specifier
CppCoreGuidelines: virtual destructor
The entire chapter C is really good here, but C35 is very important! (C120-152 is about class hierarchies)
Simplify C++: Constructor Failures
A note on how to handle erorrs during construction. Also an introduction to function-try-blocks.
CppCon 2015: Richard Powell "Intro to the C++ object model" [47min]
An intro into how the compiler sees your objects.
CppCon 2014: Michael VanLoon "Anatomy of a smart pointer" [11min]
modernes C++: "C++ Core Guidelines: Class Hierarchies"
A summary of the C++ Core Guidelines rules for class hierarchies
part 2
Pacific++ 2017: Jason Turner "Rethinking Exceptions" [1h 23min]
On how to use exceptions and noexcept in a good way (please do!)

Templates


C++ Templates are Turing Complete - Todd L. Veldhuizen
Proof that templates are Turing Complete.
[SO] C++ templates Turing-complete?
A discussion on the Turing-completeness of C++ templates.
To SFINAE or not to SFINAE @ Flaming Dangerzone
An overview of SFINAE vs tag dispatch and traits
[SO] What are unevaluated contexts in C++?
The first answer presents all the unevaluated contexts available in C++. For templates, decltype is really useful
[SO] Is it possible to write a C++ template to check for a function's existence?
Using SFINAE with C++11 to select implementation based on presence of a specific member
[SO] SFINAE:: enable_if as a function argument
An example of incorrect usage of std::enable_if and how to fix it
Simplify C++: Modern C++ Features - templated rvalue References and std::forward
An overview on perfect forwarding, reference collapsing, decltype and auto in templates
[SO] What is the difference between a trait and a policy
Explains both differences and the interaction between traits and policies
Polymorphic wrapper
An alternative to the clone pattern to create copies of a polymorphic class heirarchy
CppCon 2014: Walter E. Brown "Modern Template Metaprogramming: A compendium, Part I"
Some really nice template tricks and techniques. Also continue with part II
A flexible lexicographical comparator for C++ structs
Using templates and pointers to members to create a comparator for structs
Doing folds with help of variadic templates
A solution to get folds working without the tools available in C++17 fold expressions
Why typename?
A short presentation on why we need the typename declaration and where to use it
Type erasure
A short example of type erasure to store objects unrelated classes (i.e. not having the same base) in a genaral way.
Why template parameters of dependent type names cannot be deduced, and what to do about it
A good descussion on dependent names

Page responsible: Christoffer Holm
Last updated: 2020-01-27