mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-17 12:44:42 +03:00
int->if
This commit is contained in:
@@ -14591,7 +14591,7 @@ Documentation, readability, opportunity for reuse.
|
|||||||
|
|
||||||
auto x = find_if(vr.begin(),vr.end(),
|
auto x = find_if(vr.begin(),vr.end(),
|
||||||
[&](Rec& r) {
|
[&](Rec& r) {
|
||||||
int (r.name.size()!=n.size()) return false; // name to compare to is in n
|
if (r.name.size()!=n.size()) return false; // name to compare to is in n
|
||||||
for (int i=0; i<r.name.size(); ++i) if (tolower(r.name[i])!=tolower(n[i])) return false;
|
for (int i=0; i<r.name.size(); ++i) if (tolower(r.name[i])!=tolower(n[i])) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -14601,7 +14601,7 @@ There is a useful function lurking here (case insensitive string comparison), as
|
|||||||
|
|
||||||
bool compare_insensitive(const string& a, const string& b)
|
bool compare_insensitive(const string& a, const string& b)
|
||||||
{
|
{
|
||||||
int (a.size()!=b.size()) return false;
|
if (a.size()!=b.size()) return false;
|
||||||
for (int i=0; i<a.size(); ++i) if (tolower(a[i])!=tolower(b[i])) return false;
|
for (int i=0; i<a.size(); ++i) if (tolower(a[i])!=tolower(b[i])) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user