This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: hash_map with string keys :"instantiated from here" error & STL questions
- From: Joe Buck <Joe dot Buck at synopsys dot COM>
- To: Konstantinos Pachopoulos <kostaspaxos at yahoo dot gr>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Tue, 28 Aug 2007 14:17:39 -0700
- Subject: Re: hash_map with string keys :"instantiated from here" error & STL questions
- References: <46D48C1D.3040703@yahoo.gr>
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.