Saturday 1 October 2011

My Custom C/C++ Map Container

Here is the code for a C/C++ templated map container that I created, feel free to use it at your own leisure. It offers functionality similar to the STL Map container.

I have used this map in some of my projects on this blog to create resource management classes that ensure that mulitple instances of the same resource are not loaded.

Note you will need my Vector Container to use this Map beacuse the map uses the vector to store the elements.

Note 2 unlike other map containers this map does not sort its elements into order just because I could not be bothered to implement it at the time, its not too difficult so why not give it a try if you think you are up to it. Hint use the operators "<" ">" "==" when you successfully add a new element.

Map.h - This is the Header File:


Map.inl - This is the INL File:


Heres is a snippet of code showing how to use the map container, its pretty simple to follow. There is a #defines "FOR_EACH_MAP" that you can use if you want to make writing iteration code easier.


If you find any errors, problems etc.... with this, please use Google first however if Google does not help my E-Mail adress is matthewgolder@hotmail.co.uk.

No comments:

Post a Comment