isInfinite isInadequate

Steven Schveighoffer schveiguy at yahoo.com
Tue Mar 12 07:30:01 PDT 2013


On Tue, 12 Mar 2013 06:49:56 -0400, monarch_dodra <monarchdodra at gmail.com>  
wrote:

> On Tuesday, 12 March 2013 at 10:01:38 UTC, deadalnix wrote:
>> I want to resurrect that thread. Can someone explains the benefices of  
>> isInfinite ? I fail to see how it really benefit the code.
>
> The advantage of "enum empty = false" is that algorithms gain a great  
> performance boost by optimizing out any "if (r.empty)". This can be  
> exploited for things like take, or anything that iterates as a matter of  
> fact. I don't think anybody will argue that this is a bad approach.

Wouldn't it automatically be optimized out?  I mean if r.empty is an enum,  
it's like saying if(false)  I would think even with optimizations off,  
this might be done.

Not that I'm questioning the value of isInfinite (I'm neutral on it), but  
this is not a benefit.

-Steve


More information about the Digitalmars-d mailing list