Le Sat, 29 Nov 2008 01:49:20 +0100, BCS <[EMAIL PROTECTED]> a écrit:
struct C(R, A...)
{
A args;
R function(A) dg;
static R delegate() opCall(R function(A) dg, A a)
{
C!(R, A) ret;
ret.dg=dg;
foreach(int i,_;A)
ret.args[i] = a[i];
return &ret.fn;
}
R fn()
Reply to TSalm,
Yes, you are right.
But this is an example code. The "true" code uses delegates with
argument
which differs from called functions, so I can't point delegate
directly to
them.
And this anonymous function's way is really fastest to code... I must
waiting for a D2 stable version ;-)
Le Sat, 29 Nov 2008 01:08:28 +0100, BCS <[EMAIL PROTECTED]> a écrit:
Reply to TSalm,
Hello,
I would do something like this, but this return me an execution error
: object.Exception: Stack Overflow
// CODE
class A
{
void delegate() dg;
void doIt()
{
dg();
}
}
class B
{
A a;
th
Reply to TSalm,
Hello,
I would do something like this, but this return me an execution error
: object.Exception: Stack Overflow
// CODE
class A
{
void delegate() dg;
void doIt()
{
dg();
}
}
class B
{
A a;
this()
{
a = new A;
a.dg = { doSomething(); };
}
void doSomething() { }
}
Hello,
I would do something like this, but this return me an execution error :
object.Exception: Stack Overflow
// CODE
class A
{
void delegate() dg;
void doIt()
{
dg();
}
}
class B
{
A a;
this()
{
a = new A;
a.dg = { doSomething(); };
}
void doSomething() { }