1 /*=========================================================================
3 Program: KWSys - Kitware System Library
4 Module: $RCSfile: hash_fun.hxx.in,v $
6 Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved.
7 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notices for more information.
13 =========================================================================*/
16 * Silicon Graphics Computer Systems, Inc.
18 * Permission to use, copy, modify, distribute and sell this software
19 * and its documentation for any purpose is hereby granted without fee,
20 * provided that the above copyright notice appear in all copies and
21 * that both that copyright notice and this permission notice appear
22 * in supporting documentation. Silicon Graphics makes no
23 * representations about the suitability of this software for any
24 * purpose. It is provided "as is" without express or implied warranty.
28 * Hewlett-Packard Company
30 * Permission to use, copy, modify, distribute and sell this software
31 * and its documentation for any purpose is hereby granted without fee,
32 * provided that the above copyright notice appear in all copies and
33 * that both that copyright notice and this permission notice appear
34 * in supporting documentation. Hewlett-Packard Company makes no
35 * representations about the suitability of this software for any
36 * purpose. It is provided "as is" without express or implied warranty.
39 #ifndef @KWSYS_NAMESPACE@_hash_fun_hxx
40 #define @KWSYS_NAMESPACE@_hash_fun_hxx
42 #include <@KWSYS_NAMESPACE@/Configure.hxx>
44 #include <@KWSYS_NAMESPACE@/cstddef> // size_t
46 namespace @KWSYS_NAMESPACE@
49 template <class _Key
> struct hash
{ };
51 inline size_t _stl_hash_string(const char* __s
)
53 unsigned long __h
= 0;
60 @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
62 size_t operator()(const char* __s
) const { return _stl_hash_string(__s
); }
65 @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
66 struct hash
<const char*> {
67 size_t operator()(const char* __s
) const { return _stl_hash_string(__s
); }
70 @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
72 size_t operator()(char __x
) const { return __x
; }
75 @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
76 struct hash
<unsigned char> {
77 size_t operator()(unsigned char __x
) const { return __x
; }
80 @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
81 struct hash
<signed char> {
82 size_t operator()(unsigned char __x
) const { return __x
; }
85 @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
87 size_t operator()(short __x
) const { return __x
; }
90 @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
91 struct hash
<unsigned short> {
92 size_t operator()(unsigned short __x
) const { return __x
; }
95 @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
97 size_t operator()(int __x
) const { return __x
; }
100 @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
101 struct hash
<unsigned int> {
102 size_t operator()(unsigned int __x
) const { return __x
; }
105 @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
107 size_t operator()(long __x
) const { return __x
; }
110 @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
111 struct hash
<unsigned long> {
112 size_t operator()(unsigned long __x
) const { return __x
; }
115 } // namespace @KWSYS_NAMESPACE@