hash_map with string keys :"instantiated from here" error & STL questions
Joe Buck
Joe.Buck@synopsys.COM
Tue Aug 28 21:17:00 GMT 2007
On Tue, Aug 28, 2007 at 11:57:01PM +0300, Konstantinos Pachopoulos wrote:
> Hi,
> Greetings; that my first gcc post. Here's the code, that causes the error.
> //maps currency names(ISO namings) to a specific row and column
> //of the matrix (row_num==col_num)
> hash_map<string,int> fProductToId_;
> 1/I got an answer, that the error has to do with hash_map not being able
> to handle string objects. First, can somebody confirm that?
You need to define a hash function for strings. Then it will work.
> 2/I read somewhere, that hash_map is not "standard". What does this
> mean? Doesn't libstdc++ implement the sgi STL "standard"?
The libstdc++ hash_map comes from the SGI STL implementation, but it
was not accepted as part of the C++ standard. It's an extension,
though a widely available one.
More information about the Libstdc++
mailing list