How do you overload opEquals?

Mike Parker aldacron at gmail.com
Tue Nov 19 17:27:25 PST 2013


On 11/20/2013 5:59 AM, Dale Matthews wrote:

>
> class Vec3
> {
>
>      bool opEquals()(auto ref const Vec3 v) const


You don't need to use 'ref' on parameters that are classes. Unlike C++, 
D classes are already reference types, not value types. More like Java. 
Structs, OTOH, are value types. With those, a const ref parameter makes 
sense, but not with classes.



More information about the Digitalmars-d-learn mailing list