[Issue 10915] std.typecons.Nullable throws in writeln() if it's null

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 7 21:12:09 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10915


blm768 at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |blm768 at gmail.com


--- Comment #1 from blm768 at gmail.com 2013-10-07 21:12:04 PDT ---
It should be possible to fix this with a custom toString(), right?

struct Nullable(T) {
    // ...
    string toString() {
        if(isNull()) {
            return typeof(this).stringof ~ "(null)";
        } else {
            return typeof(this).stringof ~ "(" ~ get().to!string ~ ")";
        }
    }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list