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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:02:56+00:00 2026-05-27T23:02:56+00:00

In both implementations, the containers have store a raw array of node_type which is

  • 0

In both implementations, the containers have store a raw array of node_type which is essentially a simple linked list that stores a type T.

// From SGI
template <class _Val>
struct _Hashtable_node
{
  _Hashtable_node* _M_next;
  _Val _M_val;
}; 

I am implementing my own version for educational reasons and I am wondering why they are are not using std::list<> container for the buckets? Why write code that already exists in a std::list<>?

One reason for this that I came across may be that the std::list<> is doubly linked, so there is wasted space. But what if one uses a single linked list? And why not have the bucket_type a template parameter, so that it can be changed?

  • 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-27T23:02:56+00:00Added an answer on May 27, 2026 at 11:02 pm

    The reason for not using a list class [template] for the buckets in these implementation is that they didn’t have a singly linked list and std::list<T> is doubly linked: the extra cost of the unnecessary back pointer in terms of run-time and size would be considered bad. C++2011 now has std::forward_list<T> which pretty much came out of the desire to use it e.g. in a hashed container. This might raise the question: why didn’t they add a singly linked list then? The answer to this is also simple: a singly linked list can’t follow the standard’s container requirements and it was left for later to make the appropriate choices.

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

Sidebar

Related Questions

I recently realised that Actionscript and Javascript are both implementations of ECMA script. Now
I worked for a company that had both Java and .NET implementations of an
Both are mathematical values, however the float does have more precision. Is that the
I have a couple of classes BitMask & BitMaskLarge that both implement an interface
I have a module which runs standalone in a JVM (no containers) and communicates
Within our environment we have a core codebase, and several client-specific implementations of that
I have a factory class which imports a list of IOperation types. I get
I have an abstract class called Node . It contains a constructor that takes
Say you have 3 classes that implement IDisposable - A, B and C. Classes
I have created a class library (assembly) that provides messaging, email and sms. This

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.