Please help explain the meaning of the second if statement of the function
sting::size_type find_char(const string &s,char c,string::size_type &occurs)
{
auto ret = s.size ();
occurs = 0;
for(decltype(ret) i = 0;i != s.size(); i){
if(s[i]==c){
if(ret==s.size())//这个if语句有什么意义
ret = i;
++occurs;
}
}
return ret;
}
The idea of the second if statement is that when the value of ret is still equal to s.size(), let the value of ret equal i