On Tuesday, 25 April 2017 at 09:50:14 UTC, Basile B. wrote:
On Monday, 24 April 2017 at 16:46:21 UTC, ParticlePeter wrote:
I would like to have this kind of struct:

struct Foo {
  private int i;
void function( int i, float f ) bar; // will be defined at runtime
  void bar( float f ) {
    bar( i, f );
  }
}

[...]
How else can I get the required behavior?

Like this:

struct Foo1
{
    private void function(int,float) _bar;
    void bar(float){}
    void bar(int i, float f){_bar(i,f);}
}

Thanks for your reply, but that's what I would like to avoid, the additional indirection to call the function pointer with the original argument count. Do you have any idea about the likelihood of the compiler removing this indirection as an optimizations?

Reply via email to