Home Dashboard Directory Help
Search

std::unordered_set equality comparison broken in Visual C++ 2010 by James McNellis


Status: 

Active


2
0
Sign in
to vote
Type: Bug
ID: 557117
Opened: 5/5/2010 8:01:34 AM
Access Restriction: Public
0
Workaround(s)
view
2
User(s) can reproduce this bug

Description

In the following code, areEqual is false, when it should be true:

#include <unordered_set>

int main()
{
    std::unordered_set<int> us1;
    std::unordered_set<int> us2;

    us1.insert(15);
    us1.insert(20);

    us2.insert(20);
    us2.insert(15);

    const bool areEqual(us1 == us2);
}

The same code is broken with std::hash_set. std::hash_set equality worked correctly in Visual C++ 2008.

This issue was found in a StackOverflow question (http://stackoverflow.com/questions/2772742). I implemented a naive equality function using the language from the C++0x FCD to verify that this was in fact a bug.
Details
Sign in to post a comment.
Posted by Microsoft on 3/9/2012 at 3:55 PM
My initials. :->

STL
Posted by Ishwar Kulkarni on 3/9/2012 at 3:46 PM
Thanks for adding it in 2011. Is your contact stl@microsoft.com because you answer STL related questions like this one, or because your initials are as such? Just curious.
Posted by Microsoft on 11/1/2010 at 3:41 AM
Hi,

Thanks for reporting this bug. We've fixed it, and the fix will be available in VC11.

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 5/5/2010 at 9:03 PM
Thanks for your feedback. We were able to reproduce the issue you are seeing. We are routing 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 5/5/2010 at 5:04 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.