Skip to topic
|
Skip to bottom
Search:
Chris and Janet's website
Home
Historian
Archive
Tech
Amnesty
Home
Changes
Index
Search
Tools
Start of topic |
Skip to actions
*Making =string= the key for hash_map* <BR> If you are using gcc version 3.3.6 you'll need to wrap =operator()= in a class or struct: <verbatim> class HashString { public: unsigned operator()(std::string const &str) const { return __gnu_cxx::hash<char const*>()(str.c_str()); } }; </verbatim> then declare the hash_map like so: <verbatim> hash_map<string,string,HashString> _blahBlahMemberVariable ; </verbatim> If you are using hashmap as an extension: <verbatim> #include <ext/hash_map> </verbatim> the following technique for defining __gnu_cxx is useful: <verbatim> #define __gnu_cxx std #include <ext/hash_map> using namespace std; </verbatim> [[http://tlugforums.up.ac.za/viewtopic.php?p=14027&sid=f6785e9520d5a0924d56bec70a2fcee2][link]]
to top
End of topic
Skip to action links
|
Back to top
Edit
|
Attach image or document
|
Printable version
|
Raw text
|
More topic actions
Revisions: | r1.1
|
Total page history
|
Backlinks
You are here:
Home
>
Stl
to top