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 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
64 _GLIBCXX_BEGIN_NAMESPACE_VERSION
72 __stl_hash_string(const char* __s)
74 unsigned long __h = 0;
84 operator()(const char* __s) const
85 { return __stl_hash_string(__s); }
89 struct hash<const char*>
92 operator()(const char* __s) const
93 { return __stl_hash_string(__s); }
100 operator()(char __x) const
105 struct hash<unsigned char>
108 operator()(unsigned char __x) const
113 struct hash<signed char>
116 operator()(unsigned char __x) const
124 operator()(short __x) const
129 struct hash<unsigned short>
132 operator()(unsigned short __x) const
140 operator()(int __x) const
145 struct hash<unsigned int>
148 operator()(unsigned int __x) const
156 operator()(long __x) const
161 struct hash<unsigned long>
164 operator()(unsigned long __x) const
168 _GLIBCXX_END_NAMESPACE_VERSION