delegate as memeber

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Feb 22 07:41:30 PST 2012


On Wed, Feb 22, 2012 at 12:42:44PM +0100, deadalnix wrote:
> Le 22/02/2012 03:59, Vladimir Panteleev a écrit :
[...]
> >struct stuff {
> >private Exception function() exceptionBuilder =
> >&defaultExceptionBuilder;
> >
> >private static Exception defaultExceptionBuilder() {
> >return new Exception("foobar");
> >};
> >}
> 
> This look very promizing !!!
> 
> I'll investigate in that direction. Thank you very much for the hint.

But doesn't this only work for function pointers? I don't think you can
later assign a *delegate* to exceptionBuilder. They are different types
(delegates need fat pointers, won't fit in a function pointer).


T

-- 
Trying to define yourself is like trying to bite your own teeth. -- Alan Watts


More information about the Digitalmars-d-learn mailing list