Search code examples
c++booststlc++11unordered-set

Boost - unordered_set tutorial/examples/ANYTHING?


I'd like to use unordered_set in a project.

However, documentation for it is either incomplete or just a technical reference, no examples.

Can anyone provide links to online resources which deal with it? Books also welcome, preferably free. Google searching returned nothing of value.

Thanks!


Solution

  • There's little docs on it because it behaves exactly like std::set, with the exception that it requires a hashing and equals function instead of a comparison function. Just look up examples for std::set, and replace them with std::unordered_set and you should be fine.

    If you need to write a hashing function, there are examples in the docs, i.e. this one.