template instance cannot use local 'f' as parameter to non-global template

Trass3r un at known.com
Wed Jul 13 07:35:03 PDT 2011


Am 13.07.2011, 16:02 Uhr, schrieb Steven Schveighoffer  
<schveiguy at yahoo.com>:

>> void h() {}
>>
>> class Bla
>> {
>> 	mixin wrap!h;
>> }
>>
>> mixin template wrap(alias f)
>> {
>> 	void blub(alias g = f)()
>> 	{
		g();
>> 	}
>> }

> As a workaround, is there a reason you need blub to be parameterized?  I  
> mean, f is already part of the template.

Yep, a default function is passed to wrap and in most cases blub just  
calls that one.
But sometimes I need blub to use a function other than the default one.


More information about the Digitalmars-d-learn mailing list