What's the correct opEquals signature for structs?

Alex Rønne Petersen xtzgzorex at gmail.com
Tue Mar 13 14:16:17 PDT 2012


On 13-03-2012 22:08, H. S. Teoh wrote:
> On Tue, Mar 13, 2012 at 10:02:19PM +0100, Alex Rønne Petersen wrote:
>> On 13-03-2012 21:39, bearophile wrote:
>>> Alex R. Petersen:
>>>
>>>> (Stylistic note: use equals_t instead of bool.)
>>>
>>> What is equals_t?
>>> See it's used here:
>>> http://dlang.org/phobos/object.html
>>>
>>> Bye,
>>> bearophile
>>
>> It's just aliased to bool right now.
> [...]
>
> What's the rationale for using equals_t instead of bool? To extend to a
> ternary comparison? I thought that case was already covered by opCmp()?
>
>
> T
>

It was an integer in the past (believe it or not). :) equals_t made the 
transition easier.

-- 
- Alex


More information about the Digitalmars-d-learn mailing list