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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:34:25+00:00 2026-06-18T12:34:25+00:00

I am following http://www.cplusplus.com/reference/map/map/map/ . I am trying to build an invert index structure,

  • 0

I am following http://www.cplusplus.com/reference/map/map/map/.

I am trying to build an invert index structure, which is a map that has a 64 bits integer as a key and each key will hold a pointer to a sub-map. A sub-map will contain int int pair. So I got myself writing some samples:

map<unsigned long long int, map<int, int>*> invertID;

int main(int argc, char *argv[]){

    map<int,int>* m = new map<int,int>();

    m[10] = 1;

    invertID[1] = m;

    return 0;

}

But here is the trouble, normally, for a non-pointer type map like

std::map<char,int> first;

as described in http://www.cplusplus.com/reference/map/map/map/, I see that we can do

first['a']= 10;

But if we have a pointer type for map, how can we do that? My code above will generate an error complaining

error C2679: binary '=' : no operator found which takes a right-hand operand of type 'int' (or there is no acceptable conversion)
  • 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-18T12:34:27+00:00Added an answer on June 18, 2026 at 12:34 pm

    You can de-reference the pointer:

     (*m)[10] = 1;
    

    or

    m->operator[](10) = 1;
    

    On the other hand, do you really need all these pointers? Would your program suffer greatly from using this form?

    map<unsigned long long int, map<int, int>> invertID;
    int main()
    {
        map<int,int> m;
        invertID[1][10] = 1;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've downloaded the following template: http://www.styleshout.com/templates/preview/Refresh11/index.html But unfortunately, it has rounded corners and shades.
I'm trying to create a rewrite rule that will do the following: http://www.example.com/http://other.example.com →
According to http://www.cplusplus.com/reference/vector/vector/operator=/ I understand that we can use the '=' operator for assignment
Is the following code correct? char mychar = 200; printf(%x, mychar); According to http://www.cplusplus.com/reference/clibrary/cstdio/printf/
At http://www.cplusplus.com/reference/clibrary/cstdlib/rand/ , I read the following : This algorithm uses a seed to
So following http://www.techotopia.com/index.php/Creating_an_Interactive_iOS_4_iPhone_App , I'm doing the tutorial in a tabbed application template which
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
I am using the following http://www.ibm.com/developerworks/opensource/library/x-phpgooglecontact/index.html to authenticate to Google and retrieve a users
I'm trying to create the following: http://www.pillerdesigns.com/ftn/design6.jpg The problem is the poll in the
I am trying to achieve the following http://www.qksnap.com/i/3hunq/4ld0v/screenshot.png I am currently able to draw

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.