tags:

views:

241

answers:

2

I wrote a C++ project in VS2005, and used lots of STL container with its plus-in STL. However, I found STL in VS2005 does not have a hash_map in it, I want to use SGI hash_map. How can I change my project to use SGI STL?

Thanks for Brian's method, it works! And it's simple.

+2  A: 

VS2005 does have a hash_map:

#include <hash_map>
stdext::hash_map

If you still want to though you can download the sgi stl here. You should be able to just set the include directory to the sgi location. It will take precedence over the VC++ global include directories.

Brian R. Bondy
A: 

I do not know if VS2005 has TR1, but if it has (or if you later decide to use another compiler which has it), you can use unordered_map:

#include <tr1/unordered_map>
std::tr1::unordered_map mymap;

Also, for completeness, GCC (which used to have <hash_map>) has hash_map on <ext/hash_map> (on a different namespace). On recent GCC releases, you can also use <tr1/unordered_map>.

CesarB