Currently I'm with this:

auto ref ifNotNull(T, T2)(T lhs, lazy T2 rhs)
{
    if(lhs) {
        rhs();
    }
    return lhs;
}


far from good. I wish there was a way to create a new operator so I would make .? similar to C#'s but would evaluate the left-handed side only if it's null and do nothing otherwise (C#'s evaluate to null, probably due to lack of control of flow structure, which isn't possible within a source code, only from compiler's side, as far i know)

Reply via email to