Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8621019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:43:20+00:00 2026-06-12T06:43:20+00:00

I expected the two unordered sets below to be evaluated as equivalent, but to

  • 0

I expected the two unordered sets below to be evaluated as equivalent, but to my surprise they are not. This occurs because the two strings are stored in the same hash bucket and the operator== does a sequential comparison for the items in the set. Should this be considered a bug in std::unordered_set? Does anyone have an elegant workaround for this?

std::unordered_set<std::string> a,b;
a.insert("500666");
a.insert("961021");
b.insert("961021");
b.insert("500666");

if (a == b)   // condition is evaulated as false
{   
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T06:43:21+00:00Added an answer on June 12, 2026 at 6:43 am

    This is a known bug in the Visual C++ 2010 Standard Library implementation. This bug has been fixed in Visual C++ 2012; if this bug is affecting you, it might be worth looking into upgrading. (There was a bug on Microsoft Connect, but it seems to have vanished; I’m trying to figure out what happened to it.)

    As a workaround, consider whether you really need to use the unordered associative containers–their performance is not necessarily better than the performance of the ordered associative containers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables and they highlight as expected, but I only want the
The following code is throwing two alerts as expected in IE but not in
Two questions. 1) I understand this must be an expected outcome but maybe someone
Getting message expected identifier in red for below these two statements } else if
I have a methode in a static class and this expected two parameters and
I have two scala.xml.Elem objects (actual, expected). I am using JUnit 4, but have
When I try this, it works as expected: after two characters its shows the
I want to match (in this snippet) everything upto but not including a newline
Is it expected behavior that two encodings can map to the same decoding? I'm
I have two tests to check the expected exception throw. I am using Junit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.