Nulling a reference to a class with opAssign ...
Mike
vertex at gmx.at
Fri Dec 7 17:16:32 PST 2007
On Fri, 07 Dec 2007 23:25:44 +0100, Frank Benoit
<keinfarbton at googlemail.com> wrote:
Ok ... got it:
class Foo(T)
{
T opAssign(T v) { return v; }
}
void main()
{
auto foo = new Foo!(float)();
foo = cast(Foo!(float))null; // Works
foo = null; // Error: Can't convert null to float
}
I'm not sure ... but I think the second assignment should work.
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
More information about the Digitalmars-d-learn
mailing list