The ft_containers project aims at introducing students to C++'s Standard Template Library. Along the way we will encounter new data structures (bst, deque, stack..) and new concepts (iterators, allocators...).
This project should be C++98 compliant, we cannot use external libraries or C++11/17/20. Since we are to reimplement the STL containers we are not allowed to use them. cplusplus is used as reference as to what methods/functionalities have to be implemented. The containers iterator interfaces have to be implemented.
- list: doubly linked list
- vector: dynamic array
- stack: lifo adaptative container
- queue: fifo adaptative container
- map: associative ordered container without duplicates
- multimap: associative ordered container with duplicates
- multiset: ordered container with duplicates
- set: ordered container without duplicates
- deque: double ended queue
Proving your containers work as expected is part of the project.
The unit tests provided in this repository should only test defined behaviour.
To use my tests on your own project compile tests/main.cpp
and the container test file or take a look at the Makefile.
If a test fails you can use the main function in tests/main.cpp
compiled using the no_unit_tests
recipe or with the -DNO_UNIT_TESTS
flag to fix the issue while avoiding long compilation times.
Using the coverage
recipe you can also generate an html coverage report to detect bugs, unused code aswell as check the unit tests coverage. Be sure to run the executable to generate coverage information.
Last but not least the verify-tests
recipe compiles the unit tests with the STL containers to prove their correctness.
Unfortunately branch coverage is broken but you may get better results if you compile with -fno-exceptions
and comment out code using exceptions.
If you did not finish the tested container you will need to comment out sections which test methods you did not yet implement.
as well as countless tutorials, so posts and git repositories!