c++ - What does this conditional statement mean?
漂亮男人
漂亮男人 2017-06-19 09:07:35
0
1
930

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;
}

漂亮男人
漂亮男人

reply all(1)
曾经蜡笔没有小新

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!