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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:15:39+00:00 2026-05-23T23:15:39+00:00

The question whether a multimap preserves the insertion order of identical keys has been

  • 0

The question whether a multimap preserves the insertion order of identical keys has been asked numerous times and I think it is pretty clear that the standard says it doesn’t. Although apparently C++0x for a while said it did and then didn’t again?

Anyway, I need a structure on which I can look up by key, and iterate over it in insertion order for identical keys. Which means I can’t use compound keys, as then how could I look up by key?

So, does VC++ maintain the insertion order of identical keys for multimaps? (Or where would I look up Microsofts implementation, because I couldn’t find it?) If it doesn’t what is the best alternative? boost::multiIndex?

What if I were to instead of just inserting without position always first lookup the desired position, and pass the last element for an identical key as position suggestion (e.g. use the second iterator of equal_range)? This could maybe work (I only care about g++ and Windows compiler) I would guess as it could compare with that element, then the next, then be happy and insert? Or it could not, as the tree structure might mean it might actually not do the magic leaf switching for identical keys and if the wrong child is free insert it there?

By the way, I never understand the answers that suggest using two structures. Surely that makes deletions quite expensive?

  • 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-23T23:15:41+00:00Added an answer on May 23, 2026 at 11:15 pm

    std::map<std::vector<T> > fulfills all your requirements.

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

Sidebar

Related Questions

i asked the question of whether an index would help me: should i be
I have a general question about whether people think you should use a database
The question of whether P=NP is perhaps the most famous in all of Computer
My question is whether or not there is a way to specify the default
Leaving aside the question of whether you should serve single or multiple stylesheets, assuming
I have a question about whether or not a specific way of applying of
I just posted a question about whether WPF is a good choice for a
The question here is whether something like this already exists or, if not, whether
I'm not sure whether this question belongs on StackOverflow or SuperUser, but here goes
I was going to ask a question here about whether or not my design

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.