tags:

views:

309

answers:

3

If I want to use the hash function object provided in STL, which header file I should include on Linux? e.g. hash Hf;

+1  A: 
#include <hash_map>

on some Linux distros it's available here:

#include <ext/hash_map>

More info here. The hash_map is currently not part of the official STL but it's in TR1 as <unordered_map>.

Andreas Brinck
I know it's an extension but most C++ compilers support it.
Andreas Brinck
or <tr1/hash_map>
Samuel_xL
A: 

Is this what you are looking for:

Definition Defined in the headers hash_map and hash_set, and in the backward-compatibility headers hash_map.h and hash_set.h. This class is an SGI extension; it is not part of the C++ standard.

http://www.sgi.com/tech/stl/hash.html

Priyank Bolia
A: 

And if you like reading standards proposals, here's a copy of Matt Austern's, A Proposal to Add Hash Tables to the Standard Library.

Don Wakefield