The Final(ize) Challenge

Jarrett Billingsley jarrett.billingsley at gmail.com
Mon May 18 14:29:09 PDT 2009


On Mon, May 18, 2009 at 5:12 PM, Jarrett Billingsley
<jarrett.billingsley at gmail.com> wrote:
> ...

Aaand for contrast, if we had __ident and static foreach:

final class Finalize(T) : T
{
	this(T...)(T args) if(is(typeof(new T(args)))) { super(args); }

	static foreach(member; __traits(allMembers, T))
		static if(__traits(isVirtualFunction, __traits(getMember, T,
member)) && !__traits(isFinalFunction, __traits(getMember, T,
member)))
			override ReturnType!(__traits(getMember, T, member))
__ident(member)(ParameterTypeTuple!(__traits(getMember, T, member)
args)
				{ return super.__ident(member)(args); }
}



More information about the Digitalmars-d mailing list