We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
endsWith()
1 parent cfef803 commit f967842Copy full SHA for f967842
simplecpp.cpp
@@ -154,6 +154,9 @@ static unsigned long long stringToULL(const std::string &s)
154
155
static bool endsWith(const std::string &s, const std::string &e)
156
{
157
+ // TODO: std::equal() is much faster than std::string::compare() in a benchmark
158
+ // but in our case it leads to a big performance regression
159
+ //return (s.size() >= e.size() && s.compare(s.size() - e.size(), e.size(), e) == 0);
160
return (s.size() >= e.size()) && std::equal(e.rbegin(), e.rend(), s.rbegin());
161
}
162
0 commit comments