Commit d72ee8c7 authored by Adam Burgess's avatar Adam Burgess

Make lowercase comparisons faster

Both strings were copied and converted to lowercase before, wasting memory. Now they are compared directly.
parent ef0e0803
......@@ -30,8 +30,11 @@ struct LowercaseHash {
struct LowercaseEqual {
bool operator()(const std::string& left, const std::string& right) const {
return toLowercase(left) == toLowercase(right);
}
return std::equal(left.begin(), left.end(), right.begin(), right.end(),
[] (const char& a, const char& b) {
return std::tolower(a) == std::tolower(b);
});
};
};
class Collection {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment