Hi, i'm looking for an alternative, not so complex (very simple) version of the std::map (map - C++ Reference) class template. (for study) Can somebody point me to the right direction? Thanks in advance, pumi
Printable View
Hi, i'm looking for an alternative, not so complex (very simple) version of the std::map (map - C++ Reference) class template. (for study) Can somebody point me to the right direction? Thanks in advance, pumi
Well you could try implementing your own version.
Start with
It won't be as efficient as the standard implementation, but you should be able to explore all the concepts (and implement the API).Code:struct elem { int key, int value };
vector<elem> map;
thank you, i'm sure it won't be as efficient :) do you know any "already ready" alternatives?
I thought you wanted a "very simple" one to "study"?
"efficient" implementations are always going to be "complicated" and not something you could "study" in a short time frame.
AFAIK
std::map is a binary search tree abstracted away under that nice interface.
If you're familiar with trees, implementing one yourself would be educational.