Since beginning my programming journey, I have extensively used various containers and functionalities provided by the C++ Standard Template Library. Motivated by a desire to deepen my understanding of these structures and core concepts such as memory management, hashing, and template programming, I embarked on a project to implement my own versions of several STL components.
So far in this ongoing project, I have successfully created my own versions of several key components:
- std::vector: I started with this dynamic array because of its fundamental role in C++ programming. My implementation focuses on understanding the underlying mechanics of dynamic resizing, memory allocation, and optimal access patterns.
- HashMap: Building my own hashmap allowed me to delve into more complex data structures. This task involved mastering hashing mechanisms and dealing with collisions, which are critical for ensuring efficient data retrieval and insertion.
- Delegate (similar to C# delegates): Inspired by C#’s delegates, I implemented a similar functionality in C++. This part of the project required me to explore C++’s template metaprogramming and function pointers to mimic C#’s ability to reference and invoke methods dynamically.
This project has not only improved my technical skills but also given me invaluable insights into the inner workings of the C++ STL, enhancing both my problem-solving skills and my ability to write more efficient C++ code.