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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:34:54+00:00 2026-06-09T20:34:54+00:00

Code written in C++ Environment: Microsoft Visual Studio I have a vector of maps.

  • 0

Code written in C++

Environment: Microsoft Visual Studio

I have a vector of maps.
First I want to iterate through the first map, get its ‘first’ and ‘second’ and save them in some other structure I built (a map of vectors).
And then I’ll iterate through the left maps in my “vector of maps” and do the same…

Here’s my vector of maps:

typedef vector<map<string,unsigned int>> myvec;

And here’s the function that should do the work:

void Coogle::make_index(const myvec& the_vec)
{
    //SCAN THE FIRST MAP
    map<string,unsigned int>::iterator map_iter;
    index::iterator idx_iter = the_index.begin();
    for(map_iter=the_vec[0].begin(); map_iter!=the_vec[0].end(); ++map_iter)
    {

    }
}

The ‘for’ loop should iterate through the first map in the vector.
I declared a map iterator because I need it to iterate though the map! Right?
Why isn’t it working?

the error:

IntelliSense: no operator “=” matches these operands

Thanks a lot !!!


OK now I identified this iterator:

index::iterator idx_iter = the_index.begin();

And here’s my ‘index’:

typedef map<string,vector<unsigned int>> index;

And inside the mentioned ‘for’ loop I did the following:

    for(map_iter=the_vec[0].begin(); map_iter!=the_vec[0].end(); ++map_iter)
    {
        /*#1*/ idx_iter->first = map_iter->first;
        /*#2*/ idx_iter->second[0] = map_iter->second;
        /*#3*/ idx_iter++;
    }

#2 seems to be ok. But #1 generates an error:

IntelliSense: no operator “=” matches these operands

It’s the same error like the one before so I’m guessing it’s a similar problem.
Is it?

edit: To be more clear, what I wanna do is add from const myvec& the_vec to the ‘i’ location (in this case ‘0’) to my index.

Again :

typedef vector<map<string,unsigned int>> myvec;
typedef map<string,vector<unsigned int>> index;

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-09T20:34:56+00:00Added an answer on June 9, 2026 at 8:34 pm

    the_vec is passed as reference to constant, so you need const_iterator:

    map<string,unsigned int>::const_iterator map_iter;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a c++ source code that was written in linux/unix environment by some
I have code written in c, which contains some complex algorithms and I want
First, I have only written the code below for academic purposes. The reason I
I have written this code to fire a http request through a proxy. But
I have following code written to run NSTimer . But the NSTimer selector is
I have this code written in .NET 4.0 using VS2010 Ultimate Beta 2: smtpClient.Send(mailMsg);
I want to debug a piece of code written in C++. The problem is
I am now refactoring a code written by someone else and I have found
I have written a 3D environment in OpenGL where you can move forward/backwards and
I have written the following code to write to a file on external storage:

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.