quirks of functions and delegates

BCS ao at pathlink.com
Tue Jul 31 15:22:07 PDT 2007


Reply to Ender,

> Jarrett Billingsley Wrote:
> 
>> "Ender KaShae" <astrothayne at gmail.com> wrote in message
>> news:f8ghug$5bg$1 at digitalmars.com...
>> 
>>> 1.) when I try template t(type: function) I get an error, but there
>>> must be some way to specify that you need the type to be a function
>>> 
>> template Templ(T : U function(V), U, V...)
>> {
>> }
>> 
>> void main()
>> {
>> mixin Templ!(int); // fails
>> mixin Templ!(void function(int, float)); // OK
>> }
>> :)
>> 
> I tried that, however when instantiating the template the return type
> and paramater tuple must be explicitly given, using a static if
> statement can be used to the same affect however
> 

might this work? (I haven't tried it yet)

template T(F)
{
   staic if(is(F R == function))
   else
     static assert(false);
}





More information about the Digitalmars-d mailing list