aboutsummaryrefslogtreecommitdiff
path: root/contrib/libstdc++/include/ext/hash_fun.h
diff options
context:
space:
mode:
authorAlexander Kabaev <kan@FreeBSD.org>2007-05-19 01:25:07 +0000
committerAlexander Kabaev <kan@FreeBSD.org>2007-05-19 01:25:07 +0000
commitf8a1b7d9d8e7e8113637568c296021aea90c1b72 (patch)
treeea6c2718dc1e45ed535d194df808ef31f0ebac92 /contrib/libstdc++/include/ext/hash_fun.h
parent6b834ef156bcf24dcf0e281f57ee5bde03ca07cf (diff)
GCC 4.2.0 release C++ standard library and runtime support code.
Notes
Notes: svn path=/vendor/gcc/dist/; revision=169691
Diffstat (limited to 'contrib/libstdc++/include/ext/hash_fun.h')
-rw-r--r--contrib/libstdc++/include/ext/hash_fun.h144
1 files changed, 97 insertions, 47 deletions
diff --git a/contrib/libstdc++/include/ext/hash_fun.h b/contrib/libstdc++/include/ext/hash_fun.h
index 27453a6b006b..16c045807547 100644
--- a/contrib/libstdc++/include/ext/hash_fun.h
+++ b/contrib/libstdc++/include/ext/hash_fun.h
@@ -1,6 +1,6 @@
// 'struct hash' from SGI -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// As a special exception, you may use this file as part of a free software
@@ -55,8 +55,7 @@
/** @file ext/hash_fun.h
* This file is a GNU extension to the Standard C++ Library (possibly
- * containing extensions from the HP/SGI STL subset). You should only
- * include this header if you are using GCC 3 or later.
+ * containing extensions from the HP/SGI STL subset).
*/
#ifndef _HASH_FUN_H
@@ -64,59 +63,110 @@
#include <cstddef>
-namespace __gnu_cxx
-{
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
using std::size_t;
- template <class _Key> struct hash { };
+ template<class _Key>
+ struct hash { };
inline size_t
__stl_hash_string(const char* __s)
{
unsigned long __h = 0;
for ( ; *__s; ++__s)
- __h = 5*__h + *__s;
+ __h = 5 * __h + *__s;
return size_t(__h);
}
- template<> struct hash<char*>
- {
- size_t operator()(const char* __s) const
- { return __stl_hash_string(__s); }
- };
-
- template<> struct hash<const char*>
- {
- size_t operator()(const char* __s) const
- { return __stl_hash_string(__s); }
- };
-
- template<> struct hash<char>
- { size_t operator()(char __x) const { return __x; } };
-
- template<> struct hash<unsigned char>
- { size_t operator()(unsigned char __x) const { return __x; } };
-
- template<> struct hash<signed char>
- { size_t operator()(unsigned char __x) const { return __x; } };
-
- template<> struct hash<short>
- { size_t operator()(short __x) const { return __x; } };
-
- template<> struct hash<unsigned short>
- { size_t operator()(unsigned short __x) const { return __x; } };
-
- template<> struct hash<int>
- { size_t operator()(int __x) const { return __x; } };
-
- template<> struct hash<unsigned int>
- { size_t operator()(unsigned int __x) const { return __x; } };
-
- template<> struct hash<long>
- { size_t operator()(long __x) const { return __x; } };
-
- template<> struct hash<unsigned long>
- { size_t operator()(unsigned long __x) const { return __x; } };
-} // namespace __gnu_cxx
+ template<>
+ struct hash<char*>
+ {
+ size_t
+ operator()(const char* __s) const
+ { return __stl_hash_string(__s); }
+ };
+
+ template<>
+ struct hash<const char*>
+ {
+ size_t
+ operator()(const char* __s) const
+ { return __stl_hash_string(__s); }
+ };
+
+ template<>
+ struct hash<char>
+ {
+ size_t
+ operator()(char __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<unsigned char>
+ {
+ size_t
+ operator()(unsigned char __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<signed char>
+ {
+ size_t
+ operator()(unsigned char __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<short>
+ {
+ size_t
+ operator()(short __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<unsigned short>
+ {
+ size_t
+ operator()(unsigned short __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<int>
+ {
+ size_t
+ operator()(int __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<unsigned int>
+ {
+ size_t
+ operator()(unsigned int __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<long>
+ {
+ size_t
+ operator()(long __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<unsigned long>
+ {
+ size_t
+ operator()(unsigned long __x) const
+ { return __x; }
+ };
+
+_GLIBCXX_END_NAMESPACE
#endif