How to remove the key from the `redBlackTree` with comparator" a <= b "?

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jun 8 07:08:14 PDT 2015


On 6/8/15 6:53 AM, "Per =?UTF-8?B?Tm9yZGzDtnci?= 
<per.nordlow at gmail.com>" wrote:
> On Sunday, 7 June 2015 at 18:50:47 UTC, anonymous wrote:
>> Do not use '<=' as a comparison function with RedBlackTree. It doesn't
>> meet the requirements.
>>
>> Quoting the documentation [1]:
>>> Note that less should produce a strict ordering. That is, for two
>>> unequal elements a and b, less(a, b) == !less(b, a). less(a, a)
>>> should always equal false.
>>
>> This doesn't hold for '<='.
>
> Could we add a static check for this?

How would a static check generate a and b generically?

-Steve


More information about the Digitalmars-d-learn mailing list