llvm-6502/include/llvm/ADT/HashExtras.h
Chris Lattner 417d31c202 Move hash_* extension headers from ext/ to Support/ so that we can support
GCC 2.95, GCC 3.0.4 and GCC 3.1 all concurrently, without having to delete
headers after a chackou.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3055 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-24 21:16:42 +00:00

33 lines
870 B
C++

//===-- HashExtras.h - Useful functions for STL hash containers --*- C++ -*--=//
//
// This file contains some templates that are useful if you are working with the
// STL Hashed containers.
//
// No library is required when using these functinons.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_SUPPORT_HASHEXTRAS_H
#define LLVM_SUPPORT_HASHEXTRAS_H
#include <string>
#include <Support/hash_map>
// Cannot specialize hash template from outside of the std namespace.
namespace std {
template <> struct hash<string> {
size_t operator()(string const &str) const {
return hash<char const *>()(str.c_str());
}
};
// Provide a hash function for arbitrary pointers...
template <class T> struct hash<T *> {
inline size_t operator()(const T *Val) const { return (size_t)Val; }
};
} // End namespace std
#endif