我遇到如下问题:
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://blog.csdn.net/fnzsjt/article/details/40538463