Boost logo

Boost :

From: Rainer Deyke (rainerd_at_[hidden])
Date: 2019-11-11 11:27:07


On 11.11.19 10:27, Mathias Gaunard via Boost wrote:
> On Sun, 10 Nov 2019 at 14:16, Phil Endecott via Boost
> <boost_at_[hidden]> wrote:
>> switch (hash(s)) {
>> case "aa"HASH: if (s=="aa") f(); break;
>> case "ab"HASH: if (s=="ab") g(); break;
>> case "xy"HASH: if (s=="xy") h(); break;
>> }
>
> That code doesn't really need to check, if your hashes collide the
> compiler will reject the code.

Here 's' could have a value that does not match any of the labels (but
with the same hash as one of the labels), so the code does need to check.

-- 
Rainer Deyke (rainerd_at_[hidden])

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk