binary expression...

captain_fid via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 21 11:10:55 PDT 2016


Please forgive if asked before. My google skills seemed to fail 
me and didn't see any result from search.

My problem is simple (though not my understanding LOL).

struct D {
       int value;
       bool opEquals()(bool value) const { return (value == 
value); }
}

D aD;
if (aD == 1) { // OK
}

if (aD) {      //  Error: expression aD of type D does not have a 
boolean value
}

Is there a way to overload for this? What am I missing?




More information about the Digitalmars-d-learn mailing list