From 8e6352f8dbeedff1f529a800173b19d52ff69b6b Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 1 Sep 2011 08:07:36 -0400 Subject: KWSys: Add hash function for std::string Added hashing fuction for std::string. This adds default support for std::strings to KWSys hashing containers. Author: Bradley Lowekamp Suggested-by: Arnaud Gelas Change-Id: I7e7a0c356b73d19868a3df1db57b702ec7fffe9d --- Source/kwsys/hash_fun.hxx.in | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Source/kwsys/hash_fun.hxx.in b/Source/kwsys/hash_fun.hxx.in index 926ec92..2a1305e 100644 --- a/Source/kwsys/hash_fun.hxx.in +++ b/Source/kwsys/hash_fun.hxx.in @@ -40,6 +40,7 @@ #include <@KWSYS_NAMESPACE@/Configure.hxx> #include <@KWSYS_NAMESPACE@/FundamentalType.h> #include <@KWSYS_NAMESPACE@/cstddef> // size_t +#include <@KWSYS_NAMESPACE@/stl/string> // string namespace @KWSYS_NAMESPACE@ { @@ -66,6 +67,16 @@ struct hash { }; @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION + struct hash<@KWSYS_NAMESPACE@_stl::string> { + size_t operator()(const @KWSYS_NAMESPACE@_stl::string & __s) const { return _stl_hash_string(__s.c_str()); } +}; + +@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION + struct hash { + size_t operator()(const @KWSYS_NAMESPACE@_stl::string & __s) const { return _stl_hash_string(__s.c_str()); } +}; + +@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION struct hash { size_t operator()(char __x) const { return __x; } }; -- cgit v0.12