Imaginary code:

int index = FirstOrDefault!(int)(__traits(getAttributes, C.a));

In that case, if the tuple is empty, the value is the int's type default value.

The method is defined as  following:

template FirstOrDefault(X)(T...) {
        static if(T.length > 0) {
                enum FirstOrDefault = T[0];
        } else {
                enum FirstOrDefault = X.init;
        }
}

Reply via email to