Overloading Operator !
Chris Miller
chris at dprogramming.com
Wed Oct 25 12:50:16 PDT 2006
Overloading unary ! for classes is not a good idea because it should
always check if the reference is null; however, I believe it should be
overloadable for structs.
Supporting unary ! for structs can be as simple as using opEquals(bool).
This could also allow if(mystruct).
I would currently use this feature in my dstring module to mimic D's
if(array) (which is pretty much the same thing, a struct with fancy
if(array) and if(!array) syntax - so why not give users this power for
their [struct] types).
More information about the Digitalmars-d
mailing list