public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/47773] New: Versatile string lacks a default hash function
@ 2011-02-16 20:52 mlcreech at gmail dot com
  2011-02-16 23:03 ` [Bug libstdc++/47773] " paolo.carlini at oracle dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: mlcreech at gmail dot com @ 2011-02-16 20:52 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libstdc++/47773] Versatile string lacks a default hash function
  2011-02-16 20:52 [Bug libstdc++/47773] New: Versatile string lacks a default hash function mlcreech at gmail dot com
@ 2011-02-16 23:03 ` paolo.carlini at oracle dot com
  2011-02-17  1:27 ` paolo at gcc dot gnu.org
  2011-02-17  1:47 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-02-16 23:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47773

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.02.16 22:44:18
         AssignedTo|unassigned at gcc dot       |paolo.carlini at oracle dot
                   |gnu.org                     |com
   Target Milestone|---                         |4.6.0
     Ever Confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-02-16 22:44:18 UTC ---
Sure. Seems safe enough for 4.6.0 too.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libstdc++/47773] Versatile string lacks a default hash function
  2011-02-16 20:52 [Bug libstdc++/47773] New: Versatile string lacks a default hash function mlcreech at gmail dot com
  2011-02-16 23:03 ` [Bug libstdc++/47773] " paolo.carlini at oracle dot com
@ 2011-02-17  1:27 ` paolo at gcc dot gnu.org
  2011-02-17  1:47 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo at gcc dot gnu.org @ 2011-02-17  1:27 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47773

--- Comment #2 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2011-02-17 01:24:42 UTC ---
Author: paolo
Date: Thu Feb 17 01:24:37 2011
New Revision: 170235

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170235
Log:
2011-02-16  Paolo Carlini  <paolo.carlini@oracle.com>

    PR libstdc++/47773
    * include/ext/vstring.h (hash<__gnu_cxx::__vstring>,
    hash<__gnu_cxx::__wvstring>, hash<__gnu_cxx::__u16vstring>,
    hash<__gnu_cxx::__u32vstring>): Add.
    * testsuite/ext/vstring/hash/char/1.cc: New.
    * testsuite/ext/vstring/hash/wchar_t/1.cc: Likewise.

Added:
    trunk/libstdc++-v3/testsuite/ext/vstring/hash/
    trunk/libstdc++-v3/testsuite/ext/vstring/hash/char/
    trunk/libstdc++-v3/testsuite/ext/vstring/hash/char/1.cc
    trunk/libstdc++-v3/testsuite/ext/vstring/hash/wchar_t/
    trunk/libstdc++-v3/testsuite/ext/vstring/hash/wchar_t/1.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/ext/vstring.h


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libstdc++/47773] Versatile string lacks a default hash function
  2011-02-16 20:52 [Bug libstdc++/47773] New: Versatile string lacks a default hash function mlcreech at gmail dot com
  2011-02-16 23:03 ` [Bug libstdc++/47773] " paolo.carlini at oracle dot com
  2011-02-17  1:27 ` paolo at gcc dot gnu.org
@ 2011-02-17  1:47 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-02-17  1:47 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47773

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-02-17 01:26:59 UTC ---
Done.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-02-17  1:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-16 20:52 [Bug libstdc++/47773] New: Versatile string lacks a default hash function mlcreech at gmail dot com
2011-02-16 23:03 ` [Bug libstdc++/47773] " paolo.carlini at oracle dot com
2011-02-17  1:27 ` paolo at gcc dot gnu.org
2011-02-17  1:47 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).