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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:40:18+00:00 2026-06-05T16:40:18+00:00

I work with unordered_set . Here it’s written that it has a reserve function

  • 0

I work with unordered_set.
Here it’s written that it has a reserve function which
set buckets based on number of elements N to contain.
However, mpic++ compiler on Ubuntu complains that there is no function reserve:
class std::tr1::unordered_set<pair_int>’ has no member named ‘reserve’

I need to optimize my set to hold N elements,
it seems the max_load_factor is available, how do I come with one based on N?
Or can I optimize it somehow else?

Thanks in advance

p/s/ saw some discussion for java, but not for c++ stl lib

  • 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-05T16:40:19+00:00Added an answer on June 5, 2026 at 4:40 pm

    Load factor is independent of the number of items you insert. It’s basically the percentage of available space that’s actually in use. If, for example, you currently have space for 100 elements allocated, the maximum load factor could say to start resizing the table when you had inserted, say, 80 items (this would correspond to a maximum load factor of 80%).

    Setting the maximum load factor is, therefore, largely independent of the number of elements you’re going to store. Rather, it’s (mostly) an indication of how much extra space you’re willing to use to improve search speed. All else being equal, a table that’s closer to full will have more collisions, which will slow searching.

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

Sidebar

Related Questions

Is there a standard way to represent a set that can contain duplicate elements.
I work for a very large organization that is looking for new ideas. Currently
I work with DefaultMutableTreeNode , and it has methods depthFirstEnumeration() , breadthFirstEnumeration() and children()
I have a jQuery problem that I can't seem to work out on my
Hi I'm trying to make a function that will add a striped effect to
I have a script that's successfully doing a multiprocessing Pool set of tasks with
I have a python generator that does work that produces a large amount of
Dropdown In my site I have a set of SELECT dropdowns that are set
First off, this example will only work in a browser that supports :nth-child ,
work on asp.net vs 05 C#.Master page header contain the bellow code <script type=text/javascript

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.