automatic function call after closing block

Sergey Gromov snake.scaly at gmail.com
Sat Sep 20 09:45:48 PDT 2008


Saaa <empty at needmail.com> wrote:
> Ah, that's at least nicer, but I meant that I somehow change texture.bind() 
> to include texture.unbind()

You can do something very similar:

class Texture {
  public void bind(void delegate() body) {
    // bind a texture here
    body();
    unbind();
  }
  private void unbind() {
    // unbind the texture here
  }
}


texture.bind(
{
  // use the bound texture here
}
);


More information about the Digitalmars-d-learn mailing list