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 <blowekamp@mail.nih.gov>
Suggested-by: Arnaud Gelas <arnaud_gelas@hms.harvard.edu>
Change-Id: I7e7a0c356b73d19868a3df1db57b702ec7fffe9d
This commit is contained in:
Brad King 2011-09-01 08:07:36 -04:00
parent 917ca9f142
commit 8e6352f8db
1 changed files with 11 additions and 0 deletions

View File

@ -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@
{
@ -65,6 +66,16 @@ struct hash<const char*> {
size_t operator()(const char* __s) const { return _stl_hash_string(__s); }
};
@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<const @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<char> {
size_t operator()(char __x) const { return __x; }