This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/47773] New: Versatile string lacks a default hash function


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>.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]