Home Dashboard Directory Help

STL hash element cannot hash custom allocated strings by DeadMG


 as Fixed Help for as Fixed

Sign in
to vote
Type: Bug
ID: 626291
Opened: 12/1/2010 8:59:13 AM
Access Restriction: Public
User(s) can reproduce this bug


The provided STL hash implementation can only hash strings allocated using the default allocators. Attempting to hash a string with a custom allocator provided will result in a compile-time error, as the specialization for strings will only accept std::string or std::wstring, and not equivalent string types but with custom allocators.
Sign in to post a comment.
Posted by Microsoft on 1/5/2011 at 5:12 PM

Thanks for reporting this bug. We've already fixed it, and the fix will be available in VC11. Technically, the C++0x Working Paper N3225 only requires explicit specializations for hash<string>, hash<wstring>, hash<u16string>, and hash<u32string> (see 21.6 [basic.string.hash]), but we'll provide a partial specialization for hash<basic_string<Elem, Traits, Alloc>>.

If you have any further questions, feel free to E-mail me at stl@microsoft.com .

Stephan T. Lavavej
Visual C++ Libraries Developer
Posted by Microsoft on 12/5/2010 at 10:40 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 12/1/2010 at 11:53 PM
Thanks for reporting this issue. Please give us a demo project to demonstrate this issue so that we can conduct further research.

Thanks again for your efforts and we look forward to hearing from you.

Microsoft Visual Studio Connect Support Team
Posted by Microsoft on 12/1/2010 at 5:53 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
File Name Submitted By Submitted On File Size  
main.cpp 12/2/2010 7 KB
temp.rar 12/2/2010 7.09 MB