On 7/13/2011 11:35 PM, Trass3r wrote:
Am 13.07.2011, 16:02 Uhr, schrieb Steven Schveighoffer
<schvei...@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.
Don't know it this is the right answer or a possible bug but it does the
trick:
void h() { import std.stdio; write("h()"); }
class Bla
{
mixin wrap!h;
}
mixin template wrap(alias f)
{
void blub(typeof(&f) g = &f)
{
g();
}
}
void main()
{
Bla b = new Bla();
b.blub();
}