On Friday, 29 December 2017 at 21:43:25 UTC, Chris Paulson-Ellis wrote:
On Friday, 29 December 2017 at 21:34:27 UTC, vit wrote:
use:
   n = Nullable!Object.init;   //doesn't call destroy

instead of:
   n.nullify();

Only nullify() can make isNull return true again. I need that semantic.


    import std.typecons : Nullable;

    auto o = new Object();

    Nullable!Object n;
    assert(n.isNull == true);

    n = o;
    assert(n.isNull == false);

    n = Nullable!Object.init;
    assert(n.isNull == true);

    o.toString();       //OK

    assert(Nullable!Object.init.isNull == true);


more: https://forum.dlang.org/thread/jrdedmxnycbqzcpre...@forum.dlang.org?page=1

Reply via email to