
8 Sep
2004
8 Sep
'04
8:17 a.m.
David B. Held wrote:
I'm not so sure speed is the issue vs. size. Your typical std::map<> implementation will take about 3 pointers + int + sizeof(data) per node, whereas std::vector<> typically only has whole-container overhead. Unless your nodes are extremely large, that's not an insignificant amount of space overhead if you are only going to insert once.
Yes. Furthermore, a default constructed vector is usually small and cheap, a map isn't (there is always at least one node instantiated). Stefan