Skip to content

solaldunckel/ft_containers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ft_containers

containers

Description

ft_containers is a project written in C++ which require you to reimplement a few containers from the STL.

They must have all public member functions from C++98.

The corresponding iterators must also be implemented.

Containers

List

Unordered container with constant time for inserting/deleting elements.

Implemented as a linked-list.

Vector

Unordered container with fast access time with operator[].

Implemented as an array, similar to standard C arrays.

Map

Stores pairs key = value and is sorted by key (custom function for sorting can be templated).

Implemented as a Binary Search Tree (BST)

Stack

Last In First Out (LIFO). Basic functionnality such as push_back / pop_back / accessing last element.

Can be templated with any container supporting push_back pop_back back empty size.

Queue

First In First Out (FIFO). Basic functionnality such as push_back / pop_front / accessing first/last element.

Can be templated with any container supporting push_back pop_front back front empty size.

Usage

# include "includes/list.hpp"
# include "includes/vector.hpp"
# include "includes/map.hpp"
# include "includes/stack.hpp"
# include "includes/queue.hpp"

// Containers are in the 'ft' namespace

ft::list<int> list;
ft::vector<int> vector;
ft::map<int, std::string> map;
ft:stack<int> stack;
ft::queue<int> queue;
# Compile the sources
make

# Run the tests
./ft_containers_test [container_name] ..

Sources

Unit Tests

About

42 - Reimplement C++ Containers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published