[Issue 9164] Can't easily assign one Nullable to another
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Dec 16 18:45:19 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9164
bearophile_hugs at eml.cc changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bearophile_hugs at eml.cc
--- Comment #1 from bearophile_hugs at eml.cc 2012-12-16 18:45:18 PST ---
Adding an opAssign overload to Nullable is maybe enough:
/**
Assigns $(D value) to the internally-held state. If the assignment
succeeds, $(D this) becomes non-null.
*/
void opAssign()(T value)
{
_value = value;
_isNull = false;
}
/// ditto
void opAssign()(Nullable other)
{
_value = other._value;
_isNull = other._isNull;
}
Or maybe just (no templated):
/**
Assigns $(D value) to the internally-held state. If the assignment
succeeds, $(D this) becomes non-null.
*/
void opAssign(T value)
{
_value = value;
_isNull = false;
}
/// ditto
void opAssign(Nullable other)
{
_value = other._value;
_isNull = other._isNull;
}
--
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