My implementation of stl containers from c++98 standard, for a better understanding of basic data structures and the algorithms that apply to them.
The multiple available containers in C++ all have a very different usage. To make sure you understand them all, let’s re-implement them!
Run make
and start binary of containers
- Vector (std::vector) - sequence container representing dynamic sized array
- List (std::list) - sequence container representing double linked list
- Stack (std::stack) - lifo, based on list
- Queue (std::queue) - fifo, based on list
- Map (std::map) - associative container that store elements formed by a combination of a key value and a mapped value, based on Red-Black Tree
- Set (std::set) - container that store unique elements following a specific order, based on Red-Black Tree
- Multimap (std::multimap) - map that can store multiple unique keys, based on Red-Black Tree
- Multiset (std::multiset) - set that can store multiple unique elements, based on Red-Black Tree
- Deque (std::deque) - double ended queue, in base is dynamic array
- Implement the following containers, and turn in the necessary files .hpp
- You must also provide a main.cpp which tests everything for your evaluations.
- The member function get_allocator is not expected here, the remaining member functions are. Non-member overloads are expected aswell.
- If the container has an iterator system, you must reimplent it.
- You can use https://www.cplusplus.com/ as a reference of what to implement.
- You cannot implement more public functions than the ones offered in the standard containers. Everything else must be private or protected. Each public function/- variable must be justified.
- For non-member overloads, the keyword friend is allowed. Each use of friend must be justified and will be checked during evaluation.
You must turn in the following containers and their associated functions:
- List
- Vector
- Map
- Stack
- Queue
Of course, STL is forbidden. You are however allowed to use the STD library If you completely finished the mandatory part, you can try and turn in the bonuses.
As a bonus, you can turn in the following containers and their associated functions:
- Deque
- Set
- Multiset
- Multimap