Overload of ! operator

cal callumenator at gmail.com
Tue Jun 25 20:35:03 PDT 2013


On Wednesday, 26 June 2013 at 02:50:51 UTC, Eric wrote:
>
> Is there a way to overload the ! operator?  I can't seem to get
> it to work with the standard unaryOp method.  I need this 
> because
> I am making a wrapper for a C++ API that has ! overloaded.
>
> -Eric

According to http://dlang.org/operatoroverloading.html#Cast, the 
following are rewritten:

if (e) => if (e.opCast!(bool))
if (!e) => if (!e.opCast!(bool))

So perhaps you need to override opCast!(bool).


More information about the Digitalmars-d-learn mailing list