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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:52:18+00:00 2026-05-23T13:52:18+00:00

C++ by default provides a tree based map. With Boost you can get a

  • 0

C++ by default provides a tree based map. With Boost you can get a hashmap.

What are the advantages and disadvantages of

  1. C++’s Tree Based Map and

  2. Boost’s Hashmap
    ?

  • 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-23T13:52:19+00:00Added an answer on May 23, 2026 at 1:52 pm

    C++0x/TR1 also provides the unordered_map which is usually implemented as a hash map.

    The differences are twofold:

    1. The key type. In the ordered map, the key type must obey a strict weak ordering, and entries are maintained in that order. In the unordered map, the key type must be equality-comparable and you must provide a hash function h such that h(Key) returns size_t [thanks to Steve Jessop for the clarification].

    2. Access complexity: Insert/delete/find in an ordered map is O(log n) in the map size n. In the unordered map, it is “usually” O(1), but worst-case behaviour is O(n) (e.g. if all keys map to the same hash value).

    So the ordered map provides a total complexity guarantee, while the unordered map provides a (better) complexity in good cases, depending on the quality of your hash function.

    The internal implementation complexity of the unordered map is greater than of the ordered map, but you can imagine that you get the better access complexity because you get fewer features, i.e. you don’t get sorting for free. It’s a classical trade-off.

    Another point: Practically, if the weak ordering operator is expensive to compute, like for strings, the unordered map may actually be quite a bit faster, because comparisons on the hash type are very fast. On the other hand, if your key type is one with trivial hash function (like any built-in integral type) and if you don’t need the ordering, consider using an unordered container.

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

Sidebar

Related Questions

I understand that it provides a default implementation that the derived classes can override.
Can Hibernate 3.5.x be used as the JPA provider instead of the default provider
Can anybody confirm or deny that I can modify default styles provided by StyleCop
UINavigationController provides with default back button, which will pop the current view controller. I
The default gallery widget only provides events for when items are clicked, but is
I know that the compiler sometimes provides a default copy constructor if you don't
The default rails datetime form builder provides the following form elements as select boxes...
The default web.xml configuration for OpenAM provides a filter-mapping that includes all URI's within
Does Visual Studio or MSDN provides a default set of icons for desktop applications,
When there is no index.html Apache provides a default directory viewer, however I want

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.