GithubHelp home page GithubHelp logo

42yerevanprojects / ft_containers Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 2.45 MB

This project aims at implementing a few container types of the C++ standard template library.

C++ 73.91% Shell 0.87% Rich Text Format 3.18% C 7.11% Pascal 6.76% Objective-C 8.04% Makefile 0.13%

ft_containers's Introduction

42 ft_containers

"C++ containers, easy mode"

In this project you can find the implementations of various container types of the C++ standard template library. For each container, there is an appropriately named class files. The namespace will always be ft and the containers will be utilized by using ft::. The structure of the reference container is respected. As a reminder, I coded it in C++98, so any new feature of the containers IS NOT implemented, but every old feature (even deprecated) is implemented.

Warning: Don't copy/paste code you don't understand: it's bad for you, and for the school.

About The Project

ft_containers is a project of the mandatory part of the cursus. It's only made in C++ and was about recoding some containers from the STL.

In order to succeed, a good comprehension of how templates, iterators, containers and algorithms work was necessary. Of course, STL is not allowed. That means you cannot use <iterator> or even <utility>.

Here are the specificities of the containers implemented by me:

  • ➡️ Vector: a dynamic array that allows insertion at the end of the container. Elements can be easily access thanks with the corresponding index, but it's not the most optimal container if a lot of insertion / deletion are needed.
  • ➡️ Stack: a container adaptator (LIFO, last in first out).
  • ➡️ Queue: a container adaptator (FIFO, first in first out).
  • ➡️ Map: a sorted container using a Red Black binary tree (auto-equilibrates itself to optimize the time to find a value in the tree), in order to store the data like in a dictionnary (a key associated to its value).
  • ➡️ Set: a sorted container using a Red Black binary tree (auto-equilibrates itself to optimize the time to find a value in the tree), in order to store elements that are unique because the value of the element identifies it.
  • ➡️ Multimap: a sorted container using a Red Black binary tree (auto-equilibrates itself to optimize the time to find a value in the tree), in order to store the data like in a dictionnary (a key associated to its value), where keys are not unique.
  • ➡️ Multiset: a sorted container using a Red Black binary tree (auto-equilibrates itself to optimize the time to find a value in the tree), in order to store set elements which are not unique.

All my containers use an allocator to manage properly their memory, iterators to access their data, and handle the same constructors / methods than the containers from the STL in C++98.

Testers

The testers available in the repository :

  • mli's containers_test (very useful, much recommended) Tests not only the vector, stack, map, set but also the older version containers like deque, multimap, multiset and list (you can find them on his repo).

  • ft_containers_unit_tests Will show you the speed of your container functions in milliseconds compared to STL.

It will test all the constructors, methods and iterators, by comparating your containers with the STL containers, and making a diff if some errors occured. Also, you can choose which tests you want to execute, in the case you're checking specific containers / methods.

Resources

You can find some links and books below that might be useful during the project. Note that you do not have to read the books completly but you will find a lot of useful information there.

Books

Videos

Links

ft_containers's People

Contributors

sargis-hovsepyan 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.