When I read the Cocos2dx 3.0 API, I found something like this:
auto listener = [this](Event* event){ auto keyboardEvent = static_cast<EventKeyboard*>(event); if (keyboardEvent->_isPressed) { if (onKeyPressed != nullptr) onKeyPressed(keyboardEvent->_keyCode, event); } else { if (onKeyReleased != nullptr) onKeyReleased(keyboardEvent->_keyCode, event); } };
What does [this] mean? Is this new syntax in C++11 ?
c ++ syntax api c ++ 11 cocos2d-x
1hunch1kill Apr 08 '14 at 7:18 2014-04-08 07:18
source share