aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/ADT
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-03-04 10:23:15 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-03-04 10:23:15 +0000
commit9406da6e664a24c8e408cbba63daf162ca166ed9 (patch)
tree4f98485a81a21181813c819457cc02109c2927a9 /include/llvm/ADT
parent21d60d51618e03a970aa4c00a0d157abceedb3e7 (diff)
downloadexternal_llvm-9406da6e664a24c8e408cbba63daf162ca166ed9.zip
external_llvm-9406da6e664a24c8e408cbba63daf162ca166ed9.tar.gz
external_llvm-9406da6e664a24c8e408cbba63daf162ca166ed9.tar.bz2
Teach the hashing facilities how to hash std::string objects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152000 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT')
-rw-r--r--include/llvm/ADT/Hashing.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/llvm/ADT/Hashing.h b/include/llvm/ADT/Hashing.h
index 7bb540e..e4dc613 100644
--- a/include/llvm/ADT/Hashing.h
+++ b/include/llvm/ADT/Hashing.h
@@ -124,6 +124,10 @@ template <typename T> hash_code hash_value(const T *ptr);
template <typename T, typename U>
hash_code hash_value(const std::pair<T, U> &arg);
+/// \brief Compute a hash_code for a standard string.
+template <typename T>
+hash_code hash_value(const std::basic_string<T> &arg);
+
/// \brief Override the execution seed with a fixed value.
///
@@ -748,6 +752,13 @@ hash_code hash_value(const std::pair<T, U> &arg) {
return hash_combine(arg.first, arg.second);
}
+// Declared and documented above, but defined here so that any of the hashing
+// infrastructure is available.
+template <typename T>
+hash_code hash_value(const std::basic_string<T> &arg) {
+ return hash_combine_range(arg.begin(), arg.end());
+}
+
} // namespace llvm
#endif