diff options
author | Brad King <brad.king@kitware.com> | 2011-09-01 12:07:36 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2011-09-01 12:10:20 (GMT) |
commit | 8e6352f8dbeedff1f529a800173b19d52ff69b6b (patch) | |
tree | c5653239b0dc94190c50b578b39c966a21b7b753 /Source/kwsys/hash_fun.hxx.in | |
parent | 917ca9f1428efc73b9f23db9e5aa3dccbb15a513 (diff) | |
download | CMake-8e6352f8dbeedff1f529a800173b19d52ff69b6b.zip CMake-8e6352f8dbeedff1f529a800173b19d52ff69b6b.tar.gz CMake-8e6352f8dbeedff1f529a800173b19d52ff69b6b.tar.bz2 |
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
Diffstat (limited to 'Source/kwsys/hash_fun.hxx.in')
-rw-r--r-- | Source/kwsys/hash_fun.hxx.in | 11 |
1 files changed, 11 insertions, 0 deletions
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<const char*> { }; @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; } }; |