thanks to powerful generic ZFCallback, we are able to implement lambda feature with pure C++03
example:
) {
valueCapture.
width = 999;
btn->observerAdd(
ZFUIButton::E_ButtonOnClick(), onClick);
ZFLogTrim() <<
"before invoke: " << refCapture << valueCapture;
btn->simulateClick();
ZFLogTrim() <<
"after invoke: " << refCapture << valueCapture;
#define ZFLISTENER_2(name, CaptureParam0, capture0, CaptureParam1, capture1)
see ZFLISTENER
Definition ZFListenerDeclare.h:79
#define ZFLISTENER_END()
see ZFLISTENER
Definition ZFListenerDeclare.h:17
#define ZFLogTrim(...)
see ZFLog
Definition ZFLog.h:80
ZFUIRect const & ZFUIRectZero(void)
(0, 0, 0, 0)
Definition ZFUITypeDef.h:662
2D rectangle
Definition ZFUITypeDef.h:636
zffloat width
width
Definition ZFUITypeDef.h:640
util class to alloc and hold ZFObject type
Definition ZFObjectAutoPtr.h:157
as you may noticed, we can capture vars outside of the lambda function
you should take care of the life circle of the captured vars, though