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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:28:12+00:00 2026-05-23T22:28:12+00:00

I tried to insert a value into a boost unordered_multimap using the following code

  • 0

I tried to insert a value into a boost unordered_multimap using the following code but that didn’t work since it doesnt compile. Why is there no access [] operator?

The insert() method doesn’t work either?

#include <iostream>
#include <boost/unordered_map.hpp>

using namespace std;

int main()
{
   typedef boost::unordered_multimap<
      int,
      boost::unordered_multimap<
         int,
         boost::unordered_multimap<int, int>
      >
   > unordered_map;

   unordered_map _3d;

   _3d[0][0][0] = 10;
   _3d[0][0][0].insert(10);

   cout << _3d[0][0][0] << endl;
}

Errors:

multimap.cpp||In function 'int main()':
multimap.cpp|19|error: no match for 'operator[]' in '_3d[0]'
multimap.cpp|21|error: no match for 'operator[]' in '_3d[0]'
||=== Build finished: 2 errors, 0 warnings ===

  • 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-05-23T22:28:13+00:00Added an answer on May 23, 2026 at 10:28 pm

    Neither unordered_multimap nor multimap supports operator[] because it’s not well-defined what it would mean. The idea behind operator[] is that you could write myMap[key] to mean “the unique value associated with key in myMap.” When dealing with a unordered_multimap, this isn’t mathematically well-defined; there can be many key-value pairs with the same key in the multimap, and it’s unclear which particular value you’d like to have.

    From the example you gave, it seems like you really want to have a standard unordered_map rather than an unordered_multimap. If you’re trying to use a map of map of maps to represent some higher-dimensional array, then you probably only want to have each coordinate map to one particular subspace. Replacing unordered_multimap with unordered_map should fix this.

    Hope this helps!

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

Sidebar

Related Questions

I've cached a value using the ASP.NET Cache, with the following code: Cache.Insert(TEST_VALUE, 150,
I tried running the following statement: INSERT INTO VOUCHER (VOUCHER_NUMBER, BOOK_ID, DENOMINATION) SELECT (a.number,
I tried to insert a base64 encoded string into my SQLite database, but when
I'm using a mysql_query() in PHP to insert a value into a table in
Tried a bunch of things but I can't get it to work consistently amid
i tried something like this but the id value is not changing, getting the
I'm using Spring MVC and SimpleJdbcInsert to insert objects into a MySQL database. I'd
I have a php script that inserts values into mySQL table INSERT INTO stories
I accidentally tried to insert 'asdf' into an integer column. It worked (put 0
I'm trying to figure out how I can insert a NULL value into a

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.