Giter Site home page Giter Site logo

tblaase / ft_containers Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 519 KB

My solution for ft_containers of the Common core of 42 school.

License: MIT License

Makefile 3.60% C++ 95.13% Shell 1.27%
42 42born2code 42cursus 42heilbronn 42projects 42school containers cpp cpp98-compatible ft-containers red-black-tree stl-containers

ft_containers's Introduction

ft_containers

My solution for ft_containers of the common-core of 42 school.

Basics

The goal of this project was to recode the STL-containers of c++98.
The mandatory containers where std::vector, std::stack and std::map.
They had to have the exact same structure as the original containers and support every function the standard-containers supported.
Almost all of the needed information can be found at cplusplus.com or directly from the source code of the different libraries.

Testing

In the end of the project you had to make sure the containers worked as intended and had a good performance.
For that I created a Makefile that compiles my main.cpp with make all into two different binaries:

  • once with the std:: namespace
  • once with the ft:: namespace

After that you can run them individually to see the output.
Or run my test.sh, which does not need the make all before, since it runs make re anyways to make sure everything is in perfect working order.
This testing is also included in the github-actions of this project and are running automated on each push or pull request on the main branch.
The .yml for the github actions can be found here.

My testing script will run the two binaries one after another, put their output into .log files and diff them in two different ways.
diff1
This diff shows differences in red and similarities in green.

diff2
This diff shows the ft::containers output on the left and the std::containers output on the right.

Conclusions

This project teached the very inner workings of the c++ STL-containers, which made working with them in later projects like webserv a lot easier.
It also shows that my red_black_tree is far from perfect, which made my ft::map be a lot slower than the std::map, which can be seen in the output of my main.cpp.

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.