C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Switch on strings

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Mon, 27 Feb 2023 00:03:44 +0000
On Sun, Feb 26, 2023 at 11:06 PM Breno GuimarĂ£es <brenorg_at_[hidden]> wrote:
>
> Oops: https://godbolt.org/z/r8Mvaaevf


The solution to collisions is one of the following:

(1) Use a better hash algorithm that won't collide
(2) After the hash matches, use the equality operator to be sure

But if you're going to use the equality operator at all then you could
get rid of the hashing altogether -- unless you want to keep it in
there for speed.

Received on 2023-02-27 00:03:56