handful and interval

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Sep 2 08:05:32 PDT 2012


On 9/2/12 4:50 PM, David Nadlinger wrote:
> On Sunday, 2 September 2012 at 14:42:43 UTC, Alex Rønne Petersen wrote:
>> On 02-09-2012 16:22, Andrei Alexandrescu wrote:
>>> int x;
>>> ...
>>> if (x in interval(1, 2))
>>> {
>>> ...
>>> }
>>
>> I don't deal much in this sort of code, but I can see it being useful
>> (it's certainly prettier than writing the checks out manually). I
>> don't really know what else I would expect from such a type, though.
>
> Hm, maybe assert(interval(1, 3) & interval(2, 4) == interval(2, 3)) and
> similar operations?

Thought about sugar for set operations using arithmetic operators, but 
decided against, because that would create a lot of confusion with 
http://en.wikipedia.org/wiki/Interval_arithmetic.

Andrei


More information about the Digitalmars-d mailing list