M1 Artificial Intelligence · semester 7 · C++

C++: the machinery underneath

From a first CMake target to threads and pybind11, with the compiler set to refuse every warning along the way.

The practicals

TP1 First programs, CMake and tests Compiling and running with CMake, the course's warning flags, Boost, and Google Test. TP2 C++ without objects A 2D vector as free functions: parameters, references, const, operator overloading, file streams, exceptions. TP3 The same vector, now a class Attributes, constructors, destructor, copy semantics, resizing and smart pointers. TP4 Objects and graphs Abstract base classes, inheritance, weighted and complete graphs, multiple inheritance, path finding. TP5 Subsets and iterators A Subset class and its iterators, written to the STL's iterator contract. TP6 Templates Function templates, specialisation, class templates with non-type parameters, and variadic templates. TP7 Concurrent programming Threads, shared state, mutexes, a producer-consumer buffer with condition variables, and atomics. TP8 Binding C++ to Python pybind11: exposing constants, functions, a class with operator overloads, and an iterator.

One skeleton, and a first build that fails

Every practical starts from the same CMake template: library in src/, headers in include/, tests in tests/. It compiles with -Wall -Wextra -Wpedantic -Werror, and the provided sources are stubs that throw. So a fresh folder is expected to fail its first build: every unused parameter is an error until the function is written. That is the exercise, not a broken setup.

Templates The skeleton, reworked Presets, one executable per file in apps/, the reason behind each choice; and a second template that adds pybind11 for TP8. Source The folder on GitHub Eight practicals, the CMake skeleton, and the course note on pointers.