Me trying to implement code from the C++ STL in C++