Could you explain why the _Hash class manages buckets using both lower and upper bounds?

형진 김 20 Reputation points
2025-05-07T06:23:50.5233333+00:00

Hello,

First of all, I’d like to kindly ask for your understanding as I’m using a translation tool to write this message.

While looking into the msvc C++ _Hash class, I came across something I didn’t fully understand, so I’m reaching out with a question. From what I can tell, the _Hash class seems to manage buckets in the form of [2n, 2n + 1] I’m curious about the reasoning behind this design. Is there a specific optimization technique involved in this approach?

In particular, when calling find(), it appears that it accesses 2n + 1 and then searches backwards through the list. I’d like to understand whether this behavior is part of some optimization strategy.

Thank you very much to anyone who takes the time to read my question.

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,932 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.