Template for function or delegate (nothing else)

useo useo at start.bg
Wed Feb 9 11:48:00 PST 2011


== Auszug aus Steven Schveighoffer (schveiguy at yahoo.com)'s Artikel
> On Wed, 09 Feb 2011 14:35:42 -0500, useo <useo at start.bg> wrote:
> > Is it possible to create a template which only accepts functions
or
> > delegates like this example:
> >
> > class Example(T : void function()) { // or ..(T : void delegate
())..
> >
> > 	T callback;
> >
> > }
> >
> > Where T is a function or a delegate...
> >
> > Thanks for every suggestion!
> class Example(T) if (is(T == delegate) || is(T == function))
> {
>      T callback;
> }
> -Steve

Wow, works great - THANKS :)


More information about the Digitalmars-d-learn mailing list