Array Wierdness

Ruby The Roobster rubytheroobster at yandex.com
Wed Aug 10 15:19:41 UTC 2022


Take the following code:

```d
void main()
{
     shared class C { bool opEquals(const(shared(C)) rhs) const 
shared  { return true;}}
     const(C) c = new C();
     const(C)[] a = [c];
     const(C)[] b = [c];
     assert(a[0] == b[0]);
}
```

This code (supposedly) checks whether ```a``` and ```b``` are 
equal.  The thing is, it doesn't, because C is defined as 
```shared```.  Is there anything I can do to fix this?


More information about the Digitalmars-d-learn mailing list