[Issue 9164] New: Can't easily assign one Nullable to another
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Dec 16 02:49:10 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9164
Summary: Can't easily assign one Nullable to another
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: minor
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: lomereiter at gmail.com
--- Comment #0 from Artem Tarasov <lomereiter at gmail.com> 2012-12-16 02:49:05 PST ---
Example:
import std.typecons;
void main() {
Nullable!int a, b;
a = b; // what seems to happen is a.opAssign(b.get) => enforcement fails
}
The workaround is simple but ugly: if (b.isNull) a.nullify(); else a = b;
--
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