1 // 'struct hash' from SGI -*- C++ -*-
3 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010
4 // Free Software Foundation, Inc.
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // Under Section 7 of GPL version 3, you are granted additional
18 // permissions described in the GCC Runtime Library Exception, version
19 // 3.1, as published by the Free Software Foundation.
21 // You should have received a copy of the GNU General Public License and
22 // a copy of the GCC Runtime Library Exception along with this program;
23 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 // <http://www.gnu.org/licenses/>.
27 * Copyright (c) 1996-1998
28 * Silicon Graphics Computer Systems, Inc.
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. Silicon Graphics makes no
35 * representations about the suitability of this software for any
36 * purpose. It is provided "as is" without express or implied warranty.
40 * Hewlett-Packard Company
42 * Permission to use, copy, modify, distribute and sell this software
43 * and its documentation for any purpose is hereby granted without fee,
44 * provided that the above copyright notice appear in all copies and
45 * that both that copyright notice and this permission notice appear
46 * in supporting documentation. Hewlett-Packard Company makes no
47 * representations about the suitability of this software for any
48 * purpose. It is provided "as is" without express or implied warranty.
52 /** @file backward/hash_fun.h
53 * This file is a GNU extension to the Standard C++ Library (possibly
54 * containing extensions from the HP/SGI STL subset).
57 #ifndef _BACKWARD_HASH_FUN_H
58 #define _BACKWARD_HASH_FUN_H 1
60 #include <bits/c++config.h>
62 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx
)
70 __stl_hash_string(const char* __s
)
72 unsigned long __h
= 0;
82 operator()(const char* __s
) const
83 { return __stl_hash_string(__s
); }
87 struct hash
<const char*>
90 operator()(const char* __s
) const
91 { return __stl_hash_string(__s
); }
98 operator()(char __x
) const
103 struct hash
<unsigned char>
106 operator()(unsigned char __x
) const
111 struct hash
<signed char>
114 operator()(unsigned char __x
) const
122 operator()(short __x
) const
127 struct hash
<unsigned short>
130 operator()(unsigned short __x
) const
138 operator()(int __x
) const
143 struct hash
<unsigned int>
146 operator()(unsigned int __x
) const
154 operator()(long __x
) const
159 struct hash
<unsigned long>
162 operator()(unsigned long __x
) const
166 _GLIBCXX_END_NAMESPACE