Giter Club home page Giter Club logo

cpp07's Introduction

C++ Module 07 - Templated Classes and Functions

Overview

This repository contains the implementations for Module 07 of the 42 School's C++ curriculum, focusing on the use of templated classes and functions. C++ templates allow for generic programming, enabling functions and classes to operate with any data type without being specifically tailored for each one.

Status

Validated on 21/02/2024. Grade: 100%.

General Information

  • Compiler used: c++
  • Compilation flags: Wall -Wextra -Werror -std=c++98
  • Standard: C++98 for compliance and simplicity, per the 42 School curriculum's requirements.

Projects

This module is divided into three exercises, each emphasizing different aspects of C++ templated programming.

Exercise 00: Start with a few functions

  • Directory: ex00/
  • Files: Makefile, main.cpp, whatever.hpp
  • Description: Implement templated functions swap, min, and max that can operate on any data type supporting comparison operations.
  • Key Concepts: Templated functions, Type agnosticism, Comparison operators.

Exercise 01: Iter

  • Directory: ex01/
  • Files: Makefile, main.cpp, iter.hpp
  • Description: Create a templated function iter that applies a given function to every element of an array of any data type.
  • Key Concepts: Templated functions, Function pointers as arguments, Arrays manipulation, Type abstraction.

Exercise 02: Array

  • Directory: ex02/
  • Files: Makefile, main.cpp, Array.hpp, (optional) Array.tpp
  • Objective: Develop a templated class Array that encapsulates an array of any type, with dynamic sizing, element access, and deep copying. This exercise aims to demonstrate the utility of templates in creating versatile data structures. The Array class should manage memory carefully to avoid leaks and should throw an exception for out-of-bounds access attempts, ensuring safe and flexible array manipulation.
  • Key Concepts: Templated classes, Memory management, Operator overloading, Exception handling.

Compilation and Usage

Each exercise comes with a Makefile facilitating the compilation process. Use the following make commands to compile and clean each project:

Each exercise directory contains a Makefile for easy compilation. To compile an exercise, navigate to its directory and run:

After compilation, an executable named after the exercise (e.g., ex00, ex01, ex02) will be created. Run it with ./[executable name] to see the functionality of the implemented templates.

For example :

cd ex00 && make && ./ex00

cpp07's People

Contributors

romz8 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.