标签:
我遇到例如以下问题:
int count=0; listener->onTouchMoved=[count](Touch* t,Event* e){ count++; log("onTouchMoved"); };
那么怎样解决呢?
在 lambda表达式中。捕获的变量默认是不可变的。
This function call operator or operator template is declared const (9.3.1) if and only if the lambda-expression’s parameter-declaration-clause is not followed by mutable.
int count=0; listener->onTouchMoved=[count](Touch* t,Event* e) mutable{ count++; log("onTouchMoved"); };
标签:
原文地址:http://www.cnblogs.com/mengfanrong/p/5239786.html