2007-05-31 23:37:56 +00:00
|
|
|
// functional_hash.h header -*- C++ -*-
|
|
|
|
|
2010-02-10 05:45:24 +00:00
|
|
|
// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
2007-05-31 23:37:56 +00:00
|
|
|
//
|
|
|
|
// 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
|
|
|
|
// terms of the GNU General Public License as published by the
|
2009-04-09 17:00:19 +02:00
|
|
|
// Free Software Foundation; either version 3, or (at your option)
|
2007-05-31 23:37:56 +00:00
|
|
|
// any later version.
|
|
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
2009-04-09 17:00:19 +02:00
|
|
|
// Under Section 7 of GPL version 3, you are granted additional
|
|
|
|
// permissions described in the GCC Runtime Library Exception, version
|
|
|
|
// 3.1, as published by the Free Software Foundation.
|
2007-05-31 23:37:56 +00:00
|
|
|
|
2009-04-09 17:00:19 +02:00
|
|
|
// You should have received a copy of the GNU General Public License and
|
|
|
|
// a copy of the GCC Runtime Library Exception along with this program;
|
|
|
|
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
// <http://www.gnu.org/licenses/>.
|
2007-05-31 23:37:56 +00:00
|
|
|
|
2007-09-09 00:05:13 +00:00
|
|
|
/** @file bits/functional_hash.h
|
2007-05-31 23:37:56 +00:00
|
|
|
* This is an internal header file, included by other library headers.
|
|
|
|
* You should not attempt to use it directly.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _FUNCTIONAL_HASH_H
|
|
|
|
#define _FUNCTIONAL_HASH_H 1
|
|
|
|
|
|
|
|
#pragma GCC system_header
|
|
|
|
|
2010-06-03 19:15:56 +00:00
|
|
|
#include <bits/c++config.h>
|
2009-11-19 16:55:25 +00:00
|
|
|
|
|
|
|
namespace std
|
|
|
|
{
|
2010-02-10 05:45:24 +00:00
|
|
|
/** @defgroup hashes Hashes
|
|
|
|
* @ingroup functors
|
|
|
|
*
|
|
|
|
* Hashing functors taking a variable type and returning a @c std::size_t.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
functional_hash.h (hash<string>, [...]): Move, per DR 1182 to...
2010-02-22 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/functional_hash.h (hash<string>, hash<wstring>,
hash<u16string>, hash<u32string>, hash<error_code>): Move, per
DR 1182 to...
* include/bits/basic_string.h: ... here.
* include/std/system_error: ... and here, respectively.
* src/hash-aux.cc (hash<long double>::operator()(long double)):
Move definition...
* src/hash_c++0x.cc: ... here, new file.
* src/hash_tr1.cc: ... and here, tweak includes.
* src/compatibility-c++0x.cc (hash, _Fnv_hash): Remove.
* src/Makefile.am: Adjust.
* src/Makefile.in: Regenerate.
* include/std/functional: Include <bits/functexcept.h>.
* include/std/unordered_set: Remove redundant include.
* include/std/unordered_map: Likewise.
* include/tr1/functional_hash.h: Remove spurious trailing semicolon.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Remove
dg-excess.
From-SVN: r156971
2010-02-22 18:07:07 +00:00
|
|
|
|
2010-09-22 17:50:36 +00:00
|
|
|
template<typename _Result, typename _Arg>
|
|
|
|
struct __hash_base
|
|
|
|
{
|
|
|
|
typedef _Result result_type;
|
|
|
|
typedef _Arg argument_type;
|
|
|
|
};
|
|
|
|
|
2010-02-10 05:45:24 +00:00
|
|
|
/// Primary class template hash.
|
2009-11-19 16:55:25 +00:00
|
|
|
template<typename _Tp>
|
2010-09-22 17:50:36 +00:00
|
|
|
struct hash : public __hash_base<size_t, _Tp>
|
functional_hash.h (hash<string>, [...]): Move, per DR 1182 to...
2010-02-22 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/functional_hash.h (hash<string>, hash<wstring>,
hash<u16string>, hash<u32string>, hash<error_code>): Move, per
DR 1182 to...
* include/bits/basic_string.h: ... here.
* include/std/system_error: ... and here, respectively.
* src/hash-aux.cc (hash<long double>::operator()(long double)):
Move definition...
* src/hash_c++0x.cc: ... here, new file.
* src/hash_tr1.cc: ... and here, tweak includes.
* src/compatibility-c++0x.cc (hash, _Fnv_hash): Remove.
* src/Makefile.am: Adjust.
* src/Makefile.in: Regenerate.
* include/std/functional: Include <bits/functexcept.h>.
* include/std/unordered_set: Remove redundant include.
* include/std/unordered_map: Likewise.
* include/tr1/functional_hash.h: Remove spurious trailing semicolon.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Remove
dg-excess.
From-SVN: r156971
2010-02-22 18:07:07 +00:00
|
|
|
{
|
|
|
|
size_t
|
|
|
|
operator()(_Tp __val) const;
|
|
|
|
};
|
2009-11-19 16:55:25 +00:00
|
|
|
|
|
|
|
/// Partial specializations for pointer types.
|
|
|
|
template<typename _Tp>
|
2010-09-22 17:50:36 +00:00
|
|
|
struct hash<_Tp*> : public __hash_base<size_t, _Tp*>
|
2009-11-19 16:55:25 +00:00
|
|
|
{
|
|
|
|
size_t
|
|
|
|
operator()(_Tp* __p) const
|
|
|
|
{ return reinterpret_cast<size_t>(__p); }
|
|
|
|
};
|
|
|
|
|
2010-02-10 05:45:24 +00:00
|
|
|
// Explicit specializations for integer types.
|
functional_hash.h (hash<string>, [...]): Move, per DR 1182 to...
2010-02-22 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/functional_hash.h (hash<string>, hash<wstring>,
hash<u16string>, hash<u32string>, hash<error_code>): Move, per
DR 1182 to...
* include/bits/basic_string.h: ... here.
* include/std/system_error: ... and here, respectively.
* src/hash-aux.cc (hash<long double>::operator()(long double)):
Move definition...
* src/hash_c++0x.cc: ... here, new file.
* src/hash_tr1.cc: ... and here, tweak includes.
* src/compatibility-c++0x.cc (hash, _Fnv_hash): Remove.
* src/Makefile.am: Adjust.
* src/Makefile.in: Regenerate.
* include/std/functional: Include <bits/functexcept.h>.
* include/std/unordered_set: Remove redundant include.
* include/std/unordered_map: Likewise.
* include/tr1/functional_hash.h: Remove spurious trailing semicolon.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Remove
dg-excess.
From-SVN: r156971
2010-02-22 18:07:07 +00:00
|
|
|
#define _Cxx_hashtable_define_trivial_hash(_Tp) \
|
|
|
|
template<> \
|
|
|
|
inline size_t \
|
|
|
|
hash<_Tp>::operator()(_Tp __val) const \
|
|
|
|
{ return static_cast<size_t>(__val); }
|
2009-11-19 16:55:25 +00:00
|
|
|
|
2010-02-10 05:45:24 +00:00
|
|
|
/// Explicit specialization for bool.
|
2009-11-19 16:55:25 +00:00
|
|
|
_Cxx_hashtable_define_trivial_hash(bool);
|
2010-02-10 05:45:24 +00:00
|
|
|
|
|
|
|
/// Explicit specialization for char.
|
2009-11-19 16:55:25 +00:00
|
|
|
_Cxx_hashtable_define_trivial_hash(char);
|
2010-02-10 05:45:24 +00:00
|
|
|
|
|
|
|
/// Explicit specialization for signed char.
|
2009-11-19 16:55:25 +00:00
|
|
|
_Cxx_hashtable_define_trivial_hash(signed char);
|
2010-02-10 05:45:24 +00:00
|
|
|
|
|
|
|
/// Explicit specialization for unsigned char.
|
2009-11-19 16:55:25 +00:00
|
|
|
_Cxx_hashtable_define_trivial_hash(unsigned char);
|
2010-02-10 05:45:24 +00:00
|
|
|
|
|
|
|
/// Explicit specialization for wchar_t.
|
2009-11-19 16:55:25 +00:00
|
|
|
_Cxx_hashtable_define_trivial_hash(wchar_t);
|
2010-02-10 05:45:24 +00:00
|
|
|
|
|
|
|
/// Explicit specialization for char16_t.
|
2009-11-19 16:55:25 +00:00
|
|
|
_Cxx_hashtable_define_trivial_hash(char16_t);
|
2010-02-10 05:45:24 +00:00
|
|
|
|
|
|
|
/// Explicit specialization for char32_t.
|
2009-11-19 16:55:25 +00:00
|
|
|
_Cxx_hashtable_define_trivial_hash(char32_t);
|
2010-02-10 05:45:24 +00:00
|
|
|
|
|
|
|
/// Explicit specialization for short.
|
2009-11-19 16:55:25 +00:00
|
|
|
_Cxx_hashtable_define_trivial_hash(short);
|
2010-02-10 05:45:24 +00:00
|
|
|
|
|
|
|
/// Explicit specialization for int.
|
2009-11-19 16:55:25 +00:00
|
|
|
_Cxx_hashtable_define_trivial_hash(int);
|
2010-02-10 05:45:24 +00:00
|
|
|
|
|
|
|
/// Explicit specialization for long.
|
2009-11-19 16:55:25 +00:00
|
|
|
_Cxx_hashtable_define_trivial_hash(long);
|
2010-02-10 05:45:24 +00:00
|
|
|
|
|
|
|
/// Explicit specialization for long long.
|
2009-11-19 16:55:25 +00:00
|
|
|
_Cxx_hashtable_define_trivial_hash(long long);
|
2010-02-10 05:45:24 +00:00
|
|
|
|
|
|
|
/// Explicit specialization for unsigned short.
|
2009-11-19 16:55:25 +00:00
|
|
|
_Cxx_hashtable_define_trivial_hash(unsigned short);
|
2010-02-10 05:45:24 +00:00
|
|
|
|
|
|
|
/// Explicit specialization for unsigned int.
|
2009-11-19 16:55:25 +00:00
|
|
|
_Cxx_hashtable_define_trivial_hash(unsigned int);
|
2010-02-10 05:45:24 +00:00
|
|
|
|
|
|
|
/// Explicit specialization for unsigned long.
|
2009-11-19 16:55:25 +00:00
|
|
|
_Cxx_hashtable_define_trivial_hash(unsigned long);
|
2010-02-10 05:45:24 +00:00
|
|
|
|
|
|
|
/// Explicit specialization for unsigned long long.
|
2009-11-19 16:55:25 +00:00
|
|
|
_Cxx_hashtable_define_trivial_hash(unsigned long long);
|
|
|
|
|
|
|
|
#undef _Cxx_hashtable_define_trivial_hash
|
|
|
|
|
hash_bytes.cc: New file...
2010-09-13 Matt Austern <austern@google.com>
* src/hash_bytes.cc: New file, exports _Hash_bytes (a Murmur hash),
and _Fnv_hash_bytes (based on a FNV algorithm).
* src/compatibility-c++0x.cc (hash<string>::operator(),
hash<const string&>::operator(), hash<wstring>::operator(),
hash<const wstring&>::operator(), hash<error_code>::operator()):
Adjust, use _Hash_bytes.
* include/std/system_error (hash<error_code>::operator()): Likewise.
* include/std/thread (hash<thread::id>operator()): Likewise.
* include/std/bitset (hash<bitset>operator()): Likewise.
* include/bits/basic_string.h (hash<string>::operator(),
hash<wstring>::operator(), hash<u16string>::operator(),
hash<u32string>::operator()): Adjust.
* include/bits/vector.tcc (hash<vector<bool>>::operator()): Adjust.
* include/bits/functional_hash.h (_Hash_bytes, _Fnv_hash_bytes):
Declare.
(struct _Hash_impl, struct _Fnv_hash_impl): Add, use _Hash_bytes
and _Fnv_hash_bytes, respectively.
(hash<float>::operator(), hash<double>::operator()): Adjust.
* config/abi/pre/gnu.ver: Add exports.
* src/Makefile.am: Add.
* src/Makefile.in: Regenerate.
From-SVN: r164253
2010-09-13 18:23:56 +00:00
|
|
|
// Hash function implementation for the nontrivial specialization.
|
|
|
|
// All of them are based on a primitive that hashes a pointer to
|
|
|
|
// a byte array. The actual hash algorithm is not guaranteed to
|
|
|
|
// stay the same from release to release -- it may be updated or
|
|
|
|
// tuned to improve hash quality or speed.
|
|
|
|
size_t
|
|
|
|
_Hash_bytes(const void* __ptr, size_t __len, size_t __seed);
|
|
|
|
|
|
|
|
// A similar hash primitive, using the FNV hash algorithm. This
|
|
|
|
// algorithm is guaranteed to stay the same from release to release.
|
|
|
|
// (although it might not produce the same values on different machines.)
|
|
|
|
size_t
|
|
|
|
_Fnv_hash_bytes(const void* __ptr, size_t __len, size_t __seed);
|
|
|
|
|
|
|
|
struct _Hash_impl
|
|
|
|
{
|
|
|
|
static size_t
|
|
|
|
hash(const void* __ptr, size_t __clength,
|
|
|
|
size_t __seed = static_cast<size_t>(0xc70f6907UL))
|
|
|
|
{ return _Hash_bytes(__ptr, __clength, __seed); }
|
|
|
|
|
|
|
|
template<typename _Tp>
|
|
|
|
static size_t
|
|
|
|
hash(const _Tp& __val)
|
|
|
|
{ return hash(&__val, sizeof(__val)); }
|
|
|
|
|
|
|
|
template<typename _Tp>
|
|
|
|
static size_t
|
|
|
|
__hash_combine(const _Tp& __val, size_t __hash)
|
|
|
|
{ return hash(&__val, sizeof(__val), __hash); }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Fnv_hash_impl
|
|
|
|
{
|
|
|
|
static size_t
|
|
|
|
hash(const void* __ptr, size_t __clength,
|
|
|
|
size_t __seed = static_cast<size_t>(2166136261UL))
|
|
|
|
{ return _Fnv_hash_bytes(__ptr, __clength, __seed); }
|
|
|
|
|
|
|
|
template<typename _Tp>
|
|
|
|
static size_t
|
|
|
|
hash(const _Tp& __val)
|
|
|
|
{ return hash(&__val, sizeof(__val)); }
|
|
|
|
|
|
|
|
template<typename _Tp>
|
|
|
|
static size_t
|
|
|
|
__hash_combine(const _Tp& __val, size_t __hash)
|
|
|
|
{ return hash(&__val, sizeof(__val), __hash); }
|
|
|
|
};
|
2010-02-23 15:23:37 +00:00
|
|
|
|
functional_hash.h (hash<string>, [...]): Move, per DR 1182 to...
2010-02-22 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/functional_hash.h (hash<string>, hash<wstring>,
hash<u16string>, hash<u32string>, hash<error_code>): Move, per
DR 1182 to...
* include/bits/basic_string.h: ... here.
* include/std/system_error: ... and here, respectively.
* src/hash-aux.cc (hash<long double>::operator()(long double)):
Move definition...
* src/hash_c++0x.cc: ... here, new file.
* src/hash_tr1.cc: ... and here, tweak includes.
* src/compatibility-c++0x.cc (hash, _Fnv_hash): Remove.
* src/Makefile.am: Adjust.
* src/Makefile.in: Regenerate.
* include/std/functional: Include <bits/functexcept.h>.
* include/std/unordered_set: Remove redundant include.
* include/std/unordered_map: Likewise.
* include/tr1/functional_hash.h: Remove spurious trailing semicolon.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Remove
dg-excess.
From-SVN: r156971
2010-02-22 18:07:07 +00:00
|
|
|
/// Specialization for float.
|
2009-11-19 16:55:25 +00:00
|
|
|
template<>
|
functional_hash.h (hash<string>, [...]): Move, per DR 1182 to...
2010-02-22 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/functional_hash.h (hash<string>, hash<wstring>,
hash<u16string>, hash<u32string>, hash<error_code>): Move, per
DR 1182 to...
* include/bits/basic_string.h: ... here.
* include/std/system_error: ... and here, respectively.
* src/hash-aux.cc (hash<long double>::operator()(long double)):
Move definition...
* src/hash_c++0x.cc: ... here, new file.
* src/hash_tr1.cc: ... and here, tweak includes.
* src/compatibility-c++0x.cc (hash, _Fnv_hash): Remove.
* src/Makefile.am: Adjust.
* src/Makefile.in: Regenerate.
* include/std/functional: Include <bits/functexcept.h>.
* include/std/unordered_set: Remove redundant include.
* include/std/unordered_map: Likewise.
* include/tr1/functional_hash.h: Remove spurious trailing semicolon.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Remove
dg-excess.
From-SVN: r156971
2010-02-22 18:07:07 +00:00
|
|
|
inline size_t
|
|
|
|
hash<float>::operator()(float __val) const
|
2009-11-19 16:55:25 +00:00
|
|
|
{
|
functional_hash.h (hash<string>, [...]): Move, per DR 1182 to...
2010-02-22 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/functional_hash.h (hash<string>, hash<wstring>,
hash<u16string>, hash<u32string>, hash<error_code>): Move, per
DR 1182 to...
* include/bits/basic_string.h: ... here.
* include/std/system_error: ... and here, respectively.
* src/hash-aux.cc (hash<long double>::operator()(long double)):
Move definition...
* src/hash_c++0x.cc: ... here, new file.
* src/hash_tr1.cc: ... and here, tweak includes.
* src/compatibility-c++0x.cc (hash, _Fnv_hash): Remove.
* src/Makefile.am: Adjust.
* src/Makefile.in: Regenerate.
* include/std/functional: Include <bits/functexcept.h>.
* include/std/unordered_set: Remove redundant include.
* include/std/unordered_map: Likewise.
* include/tr1/functional_hash.h: Remove spurious trailing semicolon.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Remove
dg-excess.
From-SVN: r156971
2010-02-22 18:07:07 +00:00
|
|
|
// 0 and -0 both hash to zero.
|
hash_bytes.cc: New file...
2010-09-13 Matt Austern <austern@google.com>
* src/hash_bytes.cc: New file, exports _Hash_bytes (a Murmur hash),
and _Fnv_hash_bytes (based on a FNV algorithm).
* src/compatibility-c++0x.cc (hash<string>::operator(),
hash<const string&>::operator(), hash<wstring>::operator(),
hash<const wstring&>::operator(), hash<error_code>::operator()):
Adjust, use _Hash_bytes.
* include/std/system_error (hash<error_code>::operator()): Likewise.
* include/std/thread (hash<thread::id>operator()): Likewise.
* include/std/bitset (hash<bitset>operator()): Likewise.
* include/bits/basic_string.h (hash<string>::operator(),
hash<wstring>::operator(), hash<u16string>::operator(),
hash<u32string>::operator()): Adjust.
* include/bits/vector.tcc (hash<vector<bool>>::operator()): Adjust.
* include/bits/functional_hash.h (_Hash_bytes, _Fnv_hash_bytes):
Declare.
(struct _Hash_impl, struct _Fnv_hash_impl): Add, use _Hash_bytes
and _Fnv_hash_bytes, respectively.
(hash<float>::operator(), hash<double>::operator()): Adjust.
* config/abi/pre/gnu.ver: Add exports.
* src/Makefile.am: Add.
* src/Makefile.in: Regenerate.
From-SVN: r164253
2010-09-13 18:23:56 +00:00
|
|
|
return __val != 0.0f ? std::_Hash_impl::hash(__val) : 0;
|
functional_hash.h (hash<string>, [...]): Move, per DR 1182 to...
2010-02-22 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/functional_hash.h (hash<string>, hash<wstring>,
hash<u16string>, hash<u32string>, hash<error_code>): Move, per
DR 1182 to...
* include/bits/basic_string.h: ... here.
* include/std/system_error: ... and here, respectively.
* src/hash-aux.cc (hash<long double>::operator()(long double)):
Move definition...
* src/hash_c++0x.cc: ... here, new file.
* src/hash_tr1.cc: ... and here, tweak includes.
* src/compatibility-c++0x.cc (hash, _Fnv_hash): Remove.
* src/Makefile.am: Adjust.
* src/Makefile.in: Regenerate.
* include/std/functional: Include <bits/functexcept.h>.
* include/std/unordered_set: Remove redundant include.
* include/std/unordered_map: Likewise.
* include/tr1/functional_hash.h: Remove spurious trailing semicolon.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Remove
dg-excess.
From-SVN: r156971
2010-02-22 18:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Specialization for double.
|
2009-11-19 16:55:25 +00:00
|
|
|
template<>
|
functional_hash.h (hash<string>, [...]): Move, per DR 1182 to...
2010-02-22 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/functional_hash.h (hash<string>, hash<wstring>,
hash<u16string>, hash<u32string>, hash<error_code>): Move, per
DR 1182 to...
* include/bits/basic_string.h: ... here.
* include/std/system_error: ... and here, respectively.
* src/hash-aux.cc (hash<long double>::operator()(long double)):
Move definition...
* src/hash_c++0x.cc: ... here, new file.
* src/hash_tr1.cc: ... and here, tweak includes.
* src/compatibility-c++0x.cc (hash, _Fnv_hash): Remove.
* src/Makefile.am: Adjust.
* src/Makefile.in: Regenerate.
* include/std/functional: Include <bits/functexcept.h>.
* include/std/unordered_set: Remove redundant include.
* include/std/unordered_map: Likewise.
* include/tr1/functional_hash.h: Remove spurious trailing semicolon.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Remove
dg-excess.
From-SVN: r156971
2010-02-22 18:07:07 +00:00
|
|
|
inline size_t
|
|
|
|
hash<double>::operator()(double __val) const
|
2009-11-19 16:55:25 +00:00
|
|
|
{
|
functional_hash.h (hash<string>, [...]): Move, per DR 1182 to...
2010-02-22 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/functional_hash.h (hash<string>, hash<wstring>,
hash<u16string>, hash<u32string>, hash<error_code>): Move, per
DR 1182 to...
* include/bits/basic_string.h: ... here.
* include/std/system_error: ... and here, respectively.
* src/hash-aux.cc (hash<long double>::operator()(long double)):
Move definition...
* src/hash_c++0x.cc: ... here, new file.
* src/hash_tr1.cc: ... and here, tweak includes.
* src/compatibility-c++0x.cc (hash, _Fnv_hash): Remove.
* src/Makefile.am: Adjust.
* src/Makefile.in: Regenerate.
* include/std/functional: Include <bits/functexcept.h>.
* include/std/unordered_set: Remove redundant include.
* include/std/unordered_map: Likewise.
* include/tr1/functional_hash.h: Remove spurious trailing semicolon.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Remove
dg-excess.
From-SVN: r156971
2010-02-22 18:07:07 +00:00
|
|
|
// 0 and -0 both hash to zero.
|
hash_bytes.cc: New file...
2010-09-13 Matt Austern <austern@google.com>
* src/hash_bytes.cc: New file, exports _Hash_bytes (a Murmur hash),
and _Fnv_hash_bytes (based on a FNV algorithm).
* src/compatibility-c++0x.cc (hash<string>::operator(),
hash<const string&>::operator(), hash<wstring>::operator(),
hash<const wstring&>::operator(), hash<error_code>::operator()):
Adjust, use _Hash_bytes.
* include/std/system_error (hash<error_code>::operator()): Likewise.
* include/std/thread (hash<thread::id>operator()): Likewise.
* include/std/bitset (hash<bitset>operator()): Likewise.
* include/bits/basic_string.h (hash<string>::operator(),
hash<wstring>::operator(), hash<u16string>::operator(),
hash<u32string>::operator()): Adjust.
* include/bits/vector.tcc (hash<vector<bool>>::operator()): Adjust.
* include/bits/functional_hash.h (_Hash_bytes, _Fnv_hash_bytes):
Declare.
(struct _Hash_impl, struct _Fnv_hash_impl): Add, use _Hash_bytes
and _Fnv_hash_bytes, respectively.
(hash<float>::operator(), hash<double>::operator()): Adjust.
* config/abi/pre/gnu.ver: Add exports.
* src/Makefile.am: Add.
* src/Makefile.in: Regenerate.
From-SVN: r164253
2010-09-13 18:23:56 +00:00
|
|
|
return __val != 0.0 ? std::_Hash_impl::hash(__val) : 0;
|
functional_hash.h (hash<string>, [...]): Move, per DR 1182 to...
2010-02-22 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/functional_hash.h (hash<string>, hash<wstring>,
hash<u16string>, hash<u32string>, hash<error_code>): Move, per
DR 1182 to...
* include/bits/basic_string.h: ... here.
* include/std/system_error: ... and here, respectively.
* src/hash-aux.cc (hash<long double>::operator()(long double)):
Move definition...
* src/hash_c++0x.cc: ... here, new file.
* src/hash_tr1.cc: ... and here, tweak includes.
* src/compatibility-c++0x.cc (hash, _Fnv_hash): Remove.
* src/Makefile.am: Adjust.
* src/Makefile.in: Regenerate.
* include/std/functional: Include <bits/functexcept.h>.
* include/std/unordered_set: Remove redundant include.
* include/std/unordered_map: Likewise.
* include/tr1/functional_hash.h: Remove spurious trailing semicolon.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Remove
dg-excess.
From-SVN: r156971
2010-02-22 18:07:07 +00:00
|
|
|
}
|
2007-05-31 23:37:56 +00:00
|
|
|
|
functional_hash.h (hash<string>, [...]): Move, per DR 1182 to...
2010-02-22 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/functional_hash.h (hash<string>, hash<wstring>,
hash<u16string>, hash<u32string>, hash<error_code>): Move, per
DR 1182 to...
* include/bits/basic_string.h: ... here.
* include/std/system_error: ... and here, respectively.
* src/hash-aux.cc (hash<long double>::operator()(long double)):
Move definition...
* src/hash_c++0x.cc: ... here, new file.
* src/hash_tr1.cc: ... and here, tweak includes.
* src/compatibility-c++0x.cc (hash, _Fnv_hash): Remove.
* src/Makefile.am: Adjust.
* src/Makefile.in: Regenerate.
* include/std/functional: Include <bits/functexcept.h>.
* include/std/unordered_set: Remove redundant include.
* include/std/unordered_map: Likewise.
* include/tr1/functional_hash.h: Remove spurious trailing semicolon.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Remove
dg-excess.
From-SVN: r156971
2010-02-22 18:07:07 +00:00
|
|
|
/// Specialization for long double.
|
2009-11-19 16:55:25 +00:00
|
|
|
template<>
|
2010-03-03 01:23:07 +00:00
|
|
|
_GLIBCXX_PURE size_t
|
functional_hash.h (hash<string>, [...]): Move, per DR 1182 to...
2010-02-22 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/functional_hash.h (hash<string>, hash<wstring>,
hash<u16string>, hash<u32string>, hash<error_code>): Move, per
DR 1182 to...
* include/bits/basic_string.h: ... here.
* include/std/system_error: ... and here, respectively.
* src/hash-aux.cc (hash<long double>::operator()(long double)):
Move definition...
* src/hash_c++0x.cc: ... here, new file.
* src/hash_tr1.cc: ... and here, tweak includes.
* src/compatibility-c++0x.cc (hash, _Fnv_hash): Remove.
* src/Makefile.am: Adjust.
* src/Makefile.in: Regenerate.
* include/std/functional: Include <bits/functexcept.h>.
* include/std/unordered_set: Remove redundant include.
* include/std/unordered_map: Likewise.
* include/tr1/functional_hash.h: Remove spurious trailing semicolon.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Remove
dg-excess.
From-SVN: r156971
2010-02-22 18:07:07 +00:00
|
|
|
hash<long double>::operator()(long double __val) const;
|
2007-09-09 00:05:13 +00:00
|
|
|
|
2010-02-10 05:45:24 +00:00
|
|
|
// @} group hashes
|
2007-08-23 16:16:41 +00:00
|
|
|
}
|
|
|
|
|
2007-05-31 23:37:56 +00:00
|
|
|
#endif // _FUNCTIONAL_HASH_H
|