Table of Contents
FT_CONTAINERS is a project I've worked on during my studies at 1337 the purpose of the project is to reimplement three of the most used CPlusPlus STL containers (or four if you want to do the bonus part).
the three containers are
- one sequence container vector
- one sequence container adapter stack
- one associative container map
- another associative container set (in bonus part)
- Random access iterator to traverse the container
- enable_if and is_integral are used in some methods that require dealing with input iterators and integers
- a red-black tree class that implements most of the methods in the map container
- bidirectional_iterator to traverse the map
- a pair class to hold the value of the node in the tree
- lexicographical_compare and equal template functions are used in relational operators of the containers
- reverse_iterator template class to reverse a given iterator passed to it
if I had to retry the project I would've avoided lots of mistakes I did during my implementation of the containers these are my tips for each container.
- if you implemented a well-tested method of the vector try to use it in the other methods
- write a method for managing the capacity of the vector that treats all the cases
- focus on writing fast code and keep your file organized
- if at some point you need a temporary array use your vector instead
-
write a battle-tested tree class that uses the allocator properly and implements all the methods of the map
-
once you're done with the tree start implementing the tree iterator which is gonna be bidirectional if your iterator, const_iterator, reverse_iterator, and const_reverse_iterator are functioning you can pass them to the map
-
at this point the map is easy you just create the constructors and keep calling the _tree corresponding method whenever you needed
- most of the testers test the time complexity of your container so try to optimize your code as much as you can
- divide your code just like if norminette exists
- Don't try to create your tree algorithms the insert, delete, and search methods exists understand how they work and use them don't get overwhelmed