Implicit conversion of struct to bool for if (s) operation ?

Basile B. via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 7 09:51:06 PDT 2016


On Monday, 6 June 2016 at 15:34:18 UTC, chmike wrote:
> On Monday, 6 June 2016 at 15:28:35 UTC, John wrote:
> Thank you John and Adam. That was a quick answer !

Too late but another option would have been to put an alias this 
on a bool getter:

struct Info
{
     bool getStuff()
     {
         return true;
     }

     alias getStuff this;
}


More information about the Digitalmars-d-learn mailing list