Copying a variable state in a delegate literal definition

David Nadlinger see at klickverbot.at
Fri Sep 2 11:56:31 PDT 2011


On 9/2/11 8:29 PM, Andrej Mitrovic wrote:
> So how can I selectively copy the state of some variables at the site
> of the definition of a delegate literal?

You can try introducing a new frame using a immediately executed 
delegate literal:

button.connect!(Signal.MouseClick) = {
   auto index = menuIndex;
   return { this.showMenu(index); };
}();

David


More information about the Digitalmars-d-learn mailing list