opEquals(const ref yadaYada)

Leandro Lucarella llucax at gmail.com
Mon Dec 14 11:04:53 PST 2009


lws, el 14 de diciembre a las 08:31 me escribiste:
> Unless I'm confused, classses are ALWAYS heap (unless explicitely
> scoped) objects in D.

Yes, and classes are always references too. But that's not even the point,
the point is, the example was a struct :)

> >>>struct Foo {
> >>>bool opEquals(const ref Foo rhs) const {  // Only signature
> >>>// that compiles.
> >>>return true;
> >>>}
> >>>}
> >>>
> >>>Foo getFoo() {
> >>>return Foo();
> >>>}
> >>>
> >>>void main() {
> >>>Foo foo = getFoo();
> >>>bool isEqual = foo == getFoo();
> >>>}
> >>>
> >>>Error:  Foo.opEquals type signature should be const bool(ref const(Foo)) not
> >>>const bool(Foo rhs)
> >>>
> >>>Will this be getting fixed witht he new operator overloading?

[snip]
> (And please don't top quote, argh! ;))

!!!

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Every day 21 new born babies will be given to the wrong parents



More information about the Digitalmars-d mailing list