2011/9/5 Jonathan M Davis <[email protected]>:
> On Monday, September 05, 2011 11:20:57 Don Clugston wrote:
>> I've never been able to get that to work. Although you can get those
>> two to work, it fails in other cases. Eg, as in the code below.
>> Have you been able to do this successfully?
>>
>> [snip]
>
> Probably not. I don't think that I've tried though. I'm not sure how often
> I've used immutable structs in a context that ended up using an equality
> check.
>
> Regardless, opEquals obviously needs to be sorted out. You shouldn't need two
> definitions like that to get it to work even if they did work in all cases.

I think we need to define tow opEquals, const bool opEquals(const S
rhs) and const bool opEquals(const ref S rhs).
But rvalue version is automatically builded by compiler, like follows:

const bool opEquals(const S rhs) {
  return this.opEquals(rhs);  // run lvalue version
}

So we don't need to *write* two opEquals still.

Kenji Hara
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to