SGI STL

Anand Raman anand@kolmogorov.cog.jhu.edu
Thu Feb 12 08:00:00 GMT 1998


Hi 

I am trying to compile some code using the SGI STL with egcs 1.01.

In particular I am using hash_map from the STL which is not part of
the standard library in egcs.  Unfortunately, it comes up with a whole
lot of errors and template functions that the loader is unable to
find.

Can someone help me please.  Here is a simple program that doesn't
compile:

#include <iostream.h>
#include <string>
#include "hash_map"

struct eqstr {
  bool operator()(string s1, string s2) const {
    return s1 == s2;
  }
};

main() {
  hash_map<string ,int,hash<string>,eqstr> ords;

  ords["one"] = 1;
  cout <<ords["one"] <<endl;

  return 0;
}

However, if I replace string by "const char *" it works.  Why isn't
the hash function overloaded for string, which I would have guessed
would pretty much be a basic type?

Also, how come I get the following two warning messages:

/usr/local/include/g++/stl_hashtable.h:150: warning: decimal integer constant is so large that it is unsigned
/usr/local/include/g++/stl_hashtable.h:150: warning: decimal integer constant is so large that it is unsigned

when the constants are in fact declared already as unsigned long!

Any help in this regard will be greatly appreciated.

Many thanks.

- &



More information about the Gcc mailing list