Programming in C++ — The C++ Language, Libraries, Tools, and Other Topics

Access the lecture slides via Google Books or Google Play Books.

Table of Contents

Other Textbooks by the Author

The author also has the following (open-access) textbooks:

About the Lecture Slides

For additional information about the contents of the lecture slides, refer to the Lecture Slides Abstract section.

About the Author

For more details about the author, please visit his home page.

Lecture Slides Abstract

The abstract for the lecture slides is as follows:

This document, which consists of approximately 2500 lecture slides, offers a wealth of information on many topics relevant to programming in C++, including coverage of the C++ language itself, the C++ standard library and a variety of other libraries, numerous software tools, and an assortment of other programming-related topics. The coverage of the C++ language and standard library is current with the C++17 standard.

C++ Programming Language. Many aspects of the C++ language are covered from introductory to more advanced. This material includes: the preprocessor, language basics (objects, types, values, operators, expressions, control-flow constructs, functions, and namespaces), classes, templates (function, class, variable, and alias templates, variadic templates, template specialization, and SFINAE), lambda expressions, inheritance (run-time polymorphism and CRTP), exceptions (exception safety and RAII), smart pointers, memory management (new and delete operators and expressions, placement new, and allocators), rvalue references (move semantics and perfect forwarding), concurrency (memory models, and happens-before and synchronizes-with relationships), compile-time computation, and various other topics (e.g., copy elision and initialization).

C++ Standard Library and Various Other Libraries. Various aspects of the C++ standard library are covered including: containers, iterators, algorithms, I/O streams, time measurement, and concurrency support (threads, mutexes, condition variables, promises and futures, atomics, and fences). A number of Boost libraries are discussed, including the Intrusive, Iterator, and Container libraries. The OpenGL library and GLSL are discussed at length, along with several related libraries, including: GLFW, GLUT, and GLM. The CGAL library is also discussed in some detail.

Software Tools. A variety of software tools are discussed, including: static analysis tools (e.g., Clang Tidy and Clang Static Analyzer), code sanitizers (e.g., ASan, LSan, MSan, TSan, and UBSan), debugging and testing tools (e.g., Valgrind, LLVM XRay, and Catch2), performance analysis tools (e.g., Perf, PAPI, Gprof, and Valgrind/Callgrind), build tools (e.g., CMake and Make), version control systems (e.g., Git), code coverage analysis tools (e.g., Gcov, LLVM Cov, and Lcov), online C++ compilers (e.g., Compiler Explorer and C++ Insights), and code completion tools (e.g., YouCompleteMe, and LSP clients/servers).

Other Topics. An assortment of other programming-related topics are also covered, including: data structures, algorithms, computer arithmetic (e.g., floating-point arithmetic and interval arithmetic), cache-efficient algorithms, vectorization, good programming practices, software documentation, software testing (e.g., static and dynamic testing, and structural coverage analysis), and compilers and linkers (e.g., Itanium C++ ABI).

Lecture Slides License

The lecture slides are licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. This license allows for a work to be distributed freely, subject to certain quite reasonable conditions (e.g., no commercial use). Refer to the above link for more details on the license.
License Logo

Obtaining the Lecture Slides (E-Book and Print)

Note: New versions of the lecture slides are announced on the author's Twitter feed (@mdadams16).

All versions of the lectures slides that are currently available are listed below. All versions of these documents are available in electronic form (i.e., PDF format) for download from this web page. (See below.) Some versions of these documents are also available in print form via online order from the University of Victoria Bookstore.

The available versions of the lecture slides are as follows:

Git Repository

The lecture slides have a companion Git repository that is hosted by GitHub. This repository contains numerous code examples and programming exercises. The URL for the main web page associated with the repository is:

The URL for the Git repository itself is:

Software Development Environment (SDE)

The author has setup a basic software development environment for C++ called SDE. The SDE includes recent versions of software such as the GCC and Clang compiler tool chains, Boost, Catch2, GDB, GSL, Hub, Lcov, YouCompleteMe (YCM), and Vim LSP. For more information about SDE, refer to the official web site for SDE on GitHub:

VM disk images for the SDE are available in the Virtual Machine Disk Images section. Instructions on how to use the SDE can be found on the (above) SDE web site. If the VM disk images are used (which already have the SDE installed), the step of installing SDE is not needed. To use the SDE, simply use the sde_shell or sde_make_setup command as described in the SDE documentation.

Virtual-Machine Disk Images for SDE

Virtual-machine (VM) disk images are available for various versions of the SDE. If you have a hypervisor (i.e., VM software) on your computer, you may find these disk images to be helpful.

The following VM disk images are available for download:

Which Disk-Image Format to Use. The files with a ".gz" extension are compressed using Gzip and will need to be decompressed before use. If the VM software tool directly uses the disk image file (rather than making a copy of it), ensure that the file is both readable and writeable. The particular disk-image format that should be employed will depend on the specific VM software being used. Some VM software tools support multiple disk image formats. VirtualBox supports the VDI format (and possibly others). Many VM software tools on Linux support the QCOW2 format. VMWare supports the VMDK format (and possibly others).

Which Hypervisor Software to Use. If your computer runs Linux with secure boot enabled, it is recommended that you use GNOME Boxes (to avoid the hassle of having to cryptographically sign the kernel modules used by VirtualBox). Otherwise (e.g., if your computer runs MacOS, Windows, or Linux with secure boot disabled), the use of VirtualBox is recommended, as it generally works well and has a less restrictive license than VMWare Workstation Player.

Enabling Virtualization Support in Firmware. If you are using a hypervisor for the first time on your computer, you may need to enable virtualization in your computer's firmware (sometimes called BIOS), as hypervisor typically requires hardware support for virtualization to be enabled and this support is not always enabled by default. In order to enable this support (if required), you should look for firmware configuration settings that relate to virtualization. For example, for 64-bit Intel x86 processors, Intel-VT (Intel Virtualization Technology) support must be enabled, and for 64-bit AMD x86 processors, AMD-V (AMD Virtualization) support must be enabled.

Video Presentations

The following video presentations are available for the lecture slides:

  1. Software Tools
    1. Getting Started (Compiling and Linking C++ Programs)
  2. Version Control Systems (Git)
  3. Build Tools (Make and CMake)
  4. Basics
    1. Introduction
    2. Objects, Types, and Values
    3. Operators and Expressions
    4. Control-Flow Constructs
    5. Functions
    6. Input/Output (I/O)
    7. Miscellany
  5. Classes
    1. Introduction
    2. Members and Access Specifiers
    3. Constructors and Destructors
    4. Operator Overloading
    5. More on Classes
    6. Temporary Objects
    7. Functors
  6. Templates
    1. Introduction
    2. Function Templates
    3. Class Templates
    4. Variable Templates
    5. Alias Templates
  7. Lambda Expressions (coming soon)
  8. Classes and Inheritance (coming soon)
  9. Standard Library
    1. Introduction
    2. Containers, Iterators, and Algorithms
    3. The vector Class Template
    4. The basic_string Class Template
    5. Time Measurement
  10. Exceptions (coming soon)
  11. Rvalues References (coming soon)
  12. Concurrency
    1. Preliminaries
    2. Threads
    3. Mutexes
    4. Condition Variables
    5. Promises and Futures
    6. Atomics (coming soon)
    7. More Atomics (coming soon)
  13. Computational Geometry Algorithms Library (CGAL)
    1. Introduction
    2. Polygon Meshes
    3. Surface Subdivision Methods
    4. Example Programs for Polygon Meshes
  14. Open Graphics Library (OpenGL)
    1. Introduction
    2. GLUT
    3. (Legacy) OpenGL (Note: A new version of this video using new slides based on shaders is in preparation.)
    4. (Legacy) OpenGL Example Programs (Note: A new version of this video using new slides based on shaders is in preparation.)
  15. Signal Processing Library (SPL)
    1. Introduction

2019-05 SENG 475 Lecture Videos

The course SENG 475 (titled "Advanced Programming Techniques for Robust Efficient Computing") was taught using the slide deck available from this web site. All of the lecture content for the course was captured in video format and is available online (via YouTube). An information package for the lecture videos is available that includes:

This package is available in the form of a Zip archive:

Other Video Presentations

Some video presentations by others (i.e., not by the author of this page) that may be of interest are as follows:

  1. The Basics of Git and GitHub (July 2013)
  2. Subversion (Version Control System)

Additional References

Some other references that may be helpful are as follows:

  1. Video lectures for MIT OCW course on algorithms (Fall 2011).
  2. Video lectures for MIT OCW course on algorithms (Fall 2005).
  3. Video lectures for MIT OCW course on advanced data structures (Spring 2012).
  4. C++17 standard draft document N4659 (which is not the official ISO C++17 standard but should be quite close):
  5. C++14 standard draft document N4140 (which is not the official ISO C++14 standard but should be quite close):
  6. C++11 standard draft document N3337 (which is not the official ISO C++11 standard but should be quite close):