This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/47773] New: Versatile string lacks a default hash function
- From: "mlcreech at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 16 Feb 2011 20:48:58 +0000
- Subject: [Bug libstdc++/47773] New: Versatile string lacks a default hash function
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47773
Summary: Versatile string lacks a default hash function
Product: gcc
Version: 4.5.1
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: mlcreech@gmail.com
Created attachment 23368
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23368
Example code
__gnu_cxx::__vstring is a nice API-compatible drop-in replacement for
std::string. However, std::string defines hash functions, so that it can be
used with unordered_xxx out of the box. Currently, the versatile string
classes do not, so code which works with std::string fails with
__gnu_cxx::__vstring, with an error like:
...
undefined reference to `std::hash<__gnu_cxx::__versa_string<char,
std::char_traits<char>, std::allocator<char>, __gnu_cxx::__sso_string_base>
>::operator()(__gnu_cxx::__versa_string<char, std::char_traits<char>,
std::allocator<char>, __gnu_cxx::__sso_string_base>) const'
I just replicated what's already being done in <bits/basic_string.h> in my
code, so presumably the same could be done in <ext/vstring.h>.