Re: STL: choosing appropriate data structure
A map would be the simplest way to achieve this.
You could use a vector if the maximum id is not too large. You would have to have a method of indicating which 'slots' held valid entries.
If you go the map route and want maximum speed then try std::tr1::unordered_map. I imagine that the hash function for an unsigned long is pretty simple and fast (probably just uses the value)
"It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
Richard P. Feynman