-2

STL set are the C++ version of hashtables. What kind of hashing function does STL set use to map its keys to values , i cant seem to find any reference to it , most websites explain how to use the function but hardly talk about the hashing function

Computernerd
  • 7,378
  • 18
  • 66
  • 95
  • possible duplicate of [Does the STL contain a hashtable?](http://stackoverflow.com/questions/2192976/does-the-stl-contain-a-hashtable) – Engineer2021 Mar 17 '14 at 00:34

1 Answers1

2

STL sets are not hashtables at all. They are ordered containers. You have to explicitly use the unordered containers to get hashing behavior. Some STL implementations use RB-trees, but you'll need to read the source of the one you are using.

bmargulies
  • 97,814
  • 39
  • 186
  • 310
  • what is the equivalent of hashtables in C++ then ?? – Computernerd Mar 17 '14 at 00:32
  • 2
    @Computernerd `std::unordered_set`. You will need C++11, otherwise there is `boost::unordered_set` or `std::tr1::unordered_set` (accessing this through Boost.TR1 is probably the best, most portable way). – Potatoswatter Mar 17 '14 at 00:33