array of functions

Trass3r mrmocool at gmx.de
Thu Jun 4 09:42:02 PDT 2009


I tried to use a function lookup table to quickly access a particular one.
But the compiler (dmd1) complains about
Error: non-constant expression & func

I guess because it's used inside a class since &func is of type 
function, not delegate?


Here's a stripped down example:

protected Object function(int)[] lookup = [
	&func
];

protected Object func(int)
{
	return null;
}


More information about the Digitalmars-d-learn mailing list