This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/13342] hash_map doesn't support std::string keys


------- Additional Comments From bkoz at gcc dot gnu dot org  2003-12-09 03:08 -------

FYI we use hash strings in abi_check.cc. To do this, we do:

namespace __gnu_cxx
{
  using namespace std;
 
  template<>
    struct hash<string>
    {
      size_t operator()(const string& s) const
      {
        const collate<char>& c = use_facet<collate<char> >(locale::classic());
        return c.hash(s.c_str(), s.c_str() + s.size());
      }
    };
}

This is my preferred solution for hashing strings.

-benjamin

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13342


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]