On 2009-10-09 15:01:30 -0400, Andrei Alexandrescu <seewebsiteforem...@erdani.org> said:

static if (is(typeof({
        auto t = new T;
    })))

I'm in awe. Thanks, Jacob!!!

Andrei

Oh, wait, that doesn't work:

class A {}
class B : A { this(int) {} }

A a = new B;
clear(a); // oops

It would work, but only as a (virtual) member function redefined for every subclass. Much like a 'clone' method. Sufficient runtime reflection could work too to aleviate that, but it'd execute slower.

--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/

Reply via email to