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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:52:24+00:00 2026-06-09T05:52:24+00:00

Apparently, unordered_set::erase and unordered_set::count return something that is not strictly boolean (logically, that is,

  • 0

Apparently, unordered_set::erase and unordered_set::count return something that is not strictly boolean (logically, that is, I’m not talking about the actual type).

The linked page reads for the third version of erase:

size_type erase( const key_type& key );

Removes the elements with the key value key

This has a tone to it that suggests there could be more than just one element with a given key. It doesn’t explicitly state this, but it sounds like it a lot.
Now, the point of a set, even an unordered one, is to have each element once.

The standard library acknowledges the existence of the bool type and uses it for boolean values like unordered_set::empty(). So, what’s the point of returning size_type in the cases above? Even in spite of hash collisions, the container should distinguish elements with different keys, right? Can I still rely on that?

  • 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-09T05:52:26+00:00Added an answer on June 9, 2026 at 5:52 am

    a.erase(k) size_type Erases all elements with key
    equivalent to k. Returns the
    number of elements erased.

    b.count(k) size_type Returns the number of elements with key
    equivalent to k.

    It’s because of the unordered associative container requirements [23.2.5].

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

Sidebar

Related Questions

Apparently I've done something I'm not aware of All my classes now have warnings
Apparently I don't understand something about binding ListBox controls to data. Here is a
Apparently Range has a method that checks if it contains a value of type
Apparently mutableCopy copies by reference, not value. Ie if I do this: NSMutableArray arrayA
Apparently, there's been a big brouhaha over whether or not Python needs tail-call optimization
Apparently the following is valid in c# 4.0 regardless of the type of the
Apparently there is a database postgres that is created by default on each postgresql
Apparently Matlab load loads the data from a .mat file into the variable that
Apparently, I'm missing something fundamental. I'm having a problem with formatting the value of
Apparently, Groovy easily consumes web services. Can it consume a web service that needs

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.