On Monday, 25 June 2018 at 19:40:30 UTC, kdevel wrote:
Is it possible
to "lower" the Nullable operations if T is a class type such that there
is only one level of nullification?

Yes: https://run.dlang.io/is/hPxbyf

----
template Nullable(S)
{
    import std.traits : isPointer, isDynamicArray;
    static if (is(S == class) || is(S == interface)
               || is(S == function) || is(S == delegate)
               || isPointer!S || isDynamicArray!S)
    {
        alias Nullable = S;
    }
    else
    {
        static import std.typecons;
        alias Nullable = std.typecons.Nullable!S;
    }
}
----

Reply via email to