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

  • Home
  • SEARCH
  • 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 8899859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:57:37+00:00 2026-06-15T00:57:37+00:00

I am using an object as a key for a multimap. The object is

  • 0

I am using an object as a key for a multimap. The object is a custom date class which I created. I was just wondering if it is possible to use a variable found in the object for equal_range()?

That is check against the month variable in my custom date object.

That is something like this (pseudo code).

int january = 1;
foundValues = myMultimap.equal_range(january);

for (it=foundValues.first; it!=foundValues.second; ++it)
{
  cout << " " << (*it).second;
  cout << endl;
}

Will this go through each key object and check if the variable inside that object is equal to “january”, then return the value paired to the key?

Thank you.

  • 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-15T00:57:39+00:00Added an answer on June 15, 2026 at 12:57 am

    The search members of the associative container work on the key only. Theyexist because they take advantage of the container’s internal structure which guarantees finding values (or their absence) in O(log(n)) time (where n is the number of elements in the container).

    If you want to find all eleements in a sequence matching a condition you probably want to use std::copy_if() with a suitable predicate.

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

Sidebar

Related Questions

Possible Duplicate: Using a variable for a Javascript object key I can't figure out
Possible Duplicate: How to access object using dynamic key? I have multiple select with
I'm just trying to explore one use case of using object as a value
I want to build nested json object using python jsonpickle, something like this {key:
I have a Dictionary object that is formed using a double as its key.
I've read that using Object.prototype to attach functions to custom JavaScript objects is more
I am trying to access member variables of a class without using object. please
How can I append a value in a Hash object using a key that
I am using an object as a key in an unordered_map , so I
Is there any performance difference between querying using object for Key on an NSDictionary

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.