Home » Developing U++ » UppHub » Anonymous delegates
Anonymous delegates [message #12261] |
Mon, 22 October 2007 16:21 |
Factor
Messages: 5 Registered: June 2007 Location: Hungary
|
Promising Member |
|
|
I've written a simple header file with some macros and classes to implement a primitive form of anonymous delegates. It also contains some sort of foreach macro to use with UPP container classes.
I'll extend it in the future. Maybe somebody finds it usefull.
Example:
DELEGATE(button, WhenAction,
_this.Title("Title changed!");
);
DELEGATE1(button, WhenAction,
String, s, "Parameter test",
{
PromptOK(s);
_this.Title(s);
});
...
Vector<String> list;
...
foreach(String v,list, PromptOK(v));
String s;
foreach(String v, list,
s+=v;
PromptOK(s);
);
-
Attachment: delegates.h
(Size: 4.73KB, Downloaded 377 times)
|
|
|
Goto Forum:
Current Time: Wed Jun 12 02:08:34 CEST 2024
Total time taken to generate the page: 0.01791 seconds
|