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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:49:07+00:00 2026-05-12T06:49:07+00:00

I am looking to use an intrusive unordered_map. For some reason there is only

  • 0

I am looking to use an intrusive unordered_map. For some reason there is only an unordered_set in the library. There is also an intrusive hashtable but I’m not sure it has the same functunality, also it doesn’t have the same interface.
Am I wrong and I missed the unordered_map link?
If I am not is there a tutorial that will help me implement one?

  • 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-12T06:49:07+00:00Added an answer on May 12, 2026 at 6:49 am

    It’s an interesting question. Boost.Intrusive doesn’t seem to provide any map interface, ordered or unordered. It has a lot of implementation types that will work fine as maps both ordered (red-black trees, AVL trees, splay trees) and unordered (hashtables). But no maps and I couldn’t tell you why.

    You have two choices as I see it:

    1. Just use hashtable: the unordered containers are implemented as hashtables (and the only reason they aren’t called hash_map is to avoid name collisions with pre-existing libraries using that name already). That will work if you want to get your work done.
    2. If you really want to implement your own, you want to take a look at the interface description for Boost.Intrusive’s unordered_set. I have not looked at the implementation but it is almost certainly a wrapper around one or more of the tree types. std::set and std::map are both typically implemented as wrappers around a red-black tree (in all standard library implementations I’ve looked at: GCC’s, MSVC’s, and Apache’s stdcxx). Also take at how libstdc++ wraps their tree implementation in <map> and in <set>. It’s a lot of boilerplate, much of it tedious but both types defer almost all the work to the tree. Something analogous is almost certainly happening with Boost.Intrusive’s unordered_set. You will need to look at the differences between the map and set interfaces, and use that as the basis for modifying unordered_set into unordered_map.

    I’ve done the latter. It’s a bit on the tedious side, and I highly highly recommend writing unit tests for it (or stealing the ones that come with libstdc++ or Boost.Intrusive). But it’s doable. I also highly recommend reading the requirements documents for sets and maps, either at SGI (set, map) or for libstdc++

    Update: I realized why they aren’t doing maps: the intrusive containers require that you embed the node information for the data structure in the value type you are storing in it. For maps you would have to do this for both the values and the keys. It’s not that this isn’t possible, but the standard implementation for a map uses the same internal type as the sets do. But those internal types only have one value_type variable: to store keys and values they copy the key and the value into that variable and store that in the nodes. To do that with an intrusive type (i.e. without copying) you’d have to modify that implementation type to be incompatible with sets: it has to store references to the keys and values separately. So to do it you also have to modify the implementation you use (probably hashtable). Again not impossible, but the library designers are likely trying to avoid serious code duplication so in the absence of simple way to implement this they have most likely decided to leave maps out.

    Does that make sense?

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

Sidebar

Related Questions

I am looking to use quartz to schedule emails, but I'm not sure which
I am looking to use a PHP library for uploading pictures to a web
I am looking to use a javascript obfuscator. What are some of the most
I was looking at the boost serialization library, and the intrusive way to provide
I'm looking for a JavaScript library that will allow me to use custom events
I am looking for a lightweight JavaScript library, for use in secure environments where
We are looking to use the MVC Framework in our SP Application. This is
I'm looking to use procedurally-generated sound and music in a Flash program I'm writing.
I am looking to use Java to get the MD5 checksum of a file.
If I'm looking to use Core Animation to fade a view in and out

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.