Skip to content

natamun/42-cpp07

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

42-cpp07

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.

Usage

Each exercise (ex00 to ex02) contains its own Makefile. Compile and run individually:

cd ex00
make
./ex00

Exercises

  • ex00: Function templates — swap, min, and max implemented 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 a size() method.

Code Structure

Each exercise is self-contained in its own directory with its own source files, headers, and Makefile, following the standard 42 module layout.

About

Generic programming in C++: function templates and class templates

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors