Hello,

I have a structure with two fields ad defined as

struct Info {
    this(int value, Category category)
    {
        category_ = category;
        value_ = category ? value : 0;
    }
    ...
private:
    Category category_ = null;
    int value_ = 0;
}


I would like an implicit conversion of Info to bool that return false if category_ is null so that I can write

Info s = foo();
if (s) {
   ...
}

and where

Info s2;
assert(!s2);


Reply via email to