What is the equivalent of HashSet in C++? How do I use it (as in basic add, remove, and iterating through)
HashSet of Java?
There is no equivalent yet but one is planned for the upcoming new C++ standard. Many compiler suppliers offer it already. It's called std::tr1::unordered_set.
c++ has std::set/std::map, which is (usually) implemented as a binary tree (red/black tree as a matter of fact).
boost has a boost::hash_set/boost::hash_map which is basically the same thing, but implemented as a hash structure. This will be implemented into c++ as "std::::tr1::unordered_set" and "std::::tr1::unordered_map". Boost's structure has been renamed a a consequence.
As for how to use them, maybe the best thing for you to do is to google these structures and come back if you have any questions? I can answer any of your questions, but there are better tutorials out there then I can type right now.
Bookmarks