Difference between revisions of "Using a hashmap"

From LPTMS Wiki
Jump to: navigation, search
(Created page with "A header to use the hash_map<Key,Type> (same member functions/objects as a std::map<Key,Type>) which is not in the stl library: <source lang="cpp"> #ifdef __GNUC__ #if __...")
 
Line 1: Line 1:
 +
== with BOOST ==
 +
*[http://www.boost.org/doc/libs/1_45_0/doc/html/unordered.html unordered]
 +
 +
== with GCC ==
 
A header to use the hash_map<Key,Type> (same member functions/objects as a std::map<Key,Type>) which is not in the stl library:
 
A header to use the hash_map<Key,Type> (same member functions/objects as a std::map<Key,Type>) which is not in the stl library:
 
<source lang="cpp">
 
<source lang="cpp">

Revision as of 14:08, 8 April 2011

with BOOST

with GCC

A header to use the hash_map<Key,Type> (same member functions/objects as a std::map<Key,Type>) which is not in the stl library:

#ifdef __GNUC__
        #if __GNUC__ < 3
                #include <hash_map>
        #else
                #include <ext/hash_map>
                #if __GNUC_MINOR__ == 0
                        using namespace std;       // GCC 3.0                                                                                          
                #else
                        using namespace __gnu_cxx; // GCC >= 3.1                                                                                  
                #endif
        #endif
#endif