RE: iso C++ and ‘hash_map’ problem

John (Eljay) Love-Jensen eljay@adobe.com
Wed Jan 20 12:46:00 GMT 2010


Hi mahmoodn,

> The file has the extension hxx. I searched and some say that hash_map is not stanrad in GCC.

Correct, <hash_map> header is not standard C++, therefore it is not in the standard C++ headers with GCC.

Boost provides a hash map for C++.  <http://www.boost.org/>

The GCC I am using provides a hash map (but I'm not sure if all GCC's provide a hash map):

#include <ext/hash_map>
__gnu_cxx::hash_map<int, int> mymap;

The next standard of C++ will provide a hash map, through <unordered_map> header.  If your GCC is more current than mine, you may have that available to you now.  (You probably need to set -std= correctly.)

HTH,
--Eljay



More information about the Gcc-help mailing list