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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:58:09+00:00 2026-06-13T06:58:09+00:00

I have a pair and a map declared as such typedef pair<string,string> Key; typedef

  • 0

I have a pair and a map declared as such

typedef pair<string,string> Key;
typedef map< Key, double> Map;

i insert objects into them via a for loop as such

Key p (string1, string2 );
pair_map.insert(make_pair( p, double1 ) );

how can i find elements in the map? I am having trouble setting up the iterator with find.

Suppose I’m using it = pair_map.find(make_pair(string1,string2));

I’ve tried declaring pair_map<Key, double>::iterator it; or map<Key, double>::iterator it; but neither are working for me. How can i fix this?

the errors i get are all long invalid cast errors because of the typedef’s

  • 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-13T06:58:11+00:00Added an answer on June 13, 2026 at 6:58 am
    Map::iterator it = pair_map.find(make_pair(string1, string2));
    

    And of course you can use

    auto it = ...;
    

    or

    decltype(pair_map.begin()) it = ...;
    

    in C++11.

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

Sidebar

Related Questions

I have a vector of pair like such: vector<pair<string,double>> revenue; I want to add
I have my std::map defined as typedef std::map<string,ImageData*> ImageDataMap; typedef std::pair<string,ImageData*> ImageDataPair; typedef std::map<string,ImageData*>::iterator
I have a situation where I want to map a pair of objects to
Difference between Map and Properties as both have key-value pair.
I have a set of data(key value pair) which I need map to json,
I have this map<string, vector <pair<int, int> > > variable and I'm pushing back
I have a variable with a type similar to: map<bool, map<string, pair<string, int> >
I have a std::map declared thusly in a legacy MFC application: typedef std::map<long, CNutrientInfo>
I'm trying to insert some pair value into a map. May map is composed
Is this even possible? I have a key-pair that I already made with GPG

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.