Skip to content

Conversation

@jwakely
Copy link
Member

@jwakely jwakely commented Mar 13, 2025

A colleague was mislead into thinking that the Cpp17Hash requirements imply hash functions must be stateless, so that every h would produce the same value for h(k). I think we can dispel that just by clarifying the note, so that it doesn't seem to imply that only the value of k matters.

@jwakely
Copy link
Member Author

jwakely commented Mar 13, 2025

The normative wording before that note can also be interpreted to say that the value of h is not relevant, only k matters. So maybe we need an LWG issue here instead.

@jwakely
Copy link
Member Author

jwakely commented Mar 13, 2025

LWG2291 touched this last, but the problematic part was already there.

\begin{note}
Thus all evaluations of the expression \tcode{h(k)} with the
same value for \tcode{k} yield the same result for a given execution of the program.
same values for \tcode{h} and \tcode{k} yield the same result for a given execution of the program.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the evaluation h(k) changes h? Then, for the next evaluation, the precondition "same value of h" is not satisfied, but that's not in the spirit of the rule, I think. We should clarify that evaluation of h(k) should not change h.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwakely Did you end up opening an LWG issue? If so, can we close this one?

@tkoeppe
Copy link
Contributor

tkoeppe commented Jun 18, 2025

@jwakely ping/rebase?

@jwakely
Copy link
Member Author

jwakely commented Jul 17, 2025

I think I forgot about this one too, I'll do it tomorrow.

@jwakely
Copy link
Member Author

jwakely commented Jul 18, 2025

LWG4296

@jwakely jwakely closed this Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants