handful and interval

David Nadlinger see at klickverbot.at
Mon Sep 3 06:53:23 PDT 2012


On Monday, 3 September 2012 at 12:58:05 UTC, Andrei Alexandrescu 
wrote:
> On 9/3/12 1:24 PM, David Nadlinger wrote:
>> On Monday, 3 September 2012 at 11:20:27 UTC, Sven Torvinger 
>> wrote:
>>> if (a.among("struct", "class", "union")) { ... }
>>
>> Wouldn't that rather be a.among!("struct", "class", "union")?
>
> I'd rather have a regular function (more generally applicable) 
> that the inliner takes care of.

Where would the real difference to ["struct", "class", 
"union"].canFind(a) then? A sufficiently smart compiler (tm) 
could optimize this to a efficient string "prefix switch 
statement" just as well…

David


More information about the Digitalmars-d mailing list