The eighth C++ module of the 42 curriculum, focused on C++ templates.
This project introduces function templates and class templates, exploring how to write generic, reusable code that works across different types without duplication.
Each exercise (ex00 to ex02) contains its own Makefile. Compile and run individually:
cd ex00
make
./ex00- ex00: Function templates —
swap,min, andmaximplemented as generic functions working on any comparable type. - ex01:
iter— a function template that applies a given function to every element of an array, regardless of its type. - ex02:
Array<T>— a class template for a safe array with bounds-checked access, proper copy semantics, and asize()method.
Each exercise is self-contained in its own directory with its own source files, headers, and Makefile, following the standard 42 module layout.