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 662301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:21:49+00:00 2026-05-13T23:21:49+00:00

I am calculating intersection, union and differences of sets. I have a typedef of

  • 0

I am calculating intersection, union and differences of sets.
I have a typedef of my set type:

typedef set<node_type> node_set;

When it is replaced with

typedef hash_set<node_type> node_set;

The results are different. It’s a complicated program, and before I start debugging – am I doing it right? When I use functions like this:

set_intersection(v_higher.begin(), v_higher.end(), neighbors[w].begin(), neighbors[w].end(), 
            insert_iterator<node_set>(tmp1, tmp1.begin()));
  • should they work seamlessly with both set and hash_set?
  • 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-05-13T23:21:49+00:00Added an answer on May 13, 2026 at 11:21 pm

    I don’t think so.

    One of the pre-condition of set_intersection is:

    • [first1, last1) is ordered in ascending order according to operator<. That is, for every pair of iterators i and j in [first1, last1) such that i precedes j, *j < *i is false.

    The hash_set (and unordered_set) is unordered, so the ordered condition cannot be satisfied.

    See tr1::unordered_set union and intersection on how to intersect unordered_sets.

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

Sidebar

Related Questions

I have this problem in calculating Jaccard Distance for Sets (Bit-Vectors): p1 = 10111;
I'm calculating intersection of 2 sets of sorted numbers in a time-critical part of
I have a list of sets on which I want to perform intersection. Is
There are many good packages for calculating the intersection of polygons. I have found
Are there any libraries that provide 3D polyhedra, and support calculating the intersection of
I have a problem calculating the distance between two geopoints. The geopoints are: position1
What would be an efficient algorithm for calculating the intersection point of a line
I have a javscript code wich record visitors interaction with the website (like calculating
Basically I have I have a sets of nodes containing gps coordinates, How do
Calculating the area of a simple irregular polygon is trivial . However, consider the

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.