我想知道:有没有可能为每个添加额外的条件?我正在考虑类似的事情:
int i=0;
for(auto &it : list; i++)
if(it.ID == 25)
return i;
Run Code Online (Sandbox Code Playgroud)
或者
for(auto &it : list, int i=0; i++)
if(it.ID == 25)
return i;
Run Code Online (Sandbox Code Playgroud)