The Final(ize) Challenge
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon May 18 10:55:40 PDT 2009
Andrei Alexandrescu wrote:
> Jarrett Billingsley wrote:
>> On Mon, May 18, 2009 at 1:48 PM, Andrei Alexandrescu
>> <SeeWebsiteForEmail at erdani.org> wrote:
>>> Jarrett Billingsley wrote:
>>>> The second is worse. __ctor (if it exists) is not virtual, so it's
>>>> not possible to get a list of overloads of it with __traits.
>>> This is a simple one:
>>>
>>> final class Finalize(C) : C
>>> {
>>> this(A...)(A args) if (is(new C(args))
>>> {
>>> super(args);
>>> }
>>> }
>>
>> What the!
>
> I know, I didn't close a paren :o).
>
> Andrei
And I forgot the typeof again :o(. Redux:
final class Finalize(C) : C
{
this(A...)(A args) if (is(typeof(new C(args))))
{
super(args);
}
}
This won't compile with 2.030 (args is not visible in the if-clause),
but it should, and Walter has fixed that in his tree already.
Andrei
More information about the Digitalmars-d
mailing list