Looking at the std::string comparison operators, they all seem to be
using std::string::compare directly even in cases where the string
lengths must match. Comparing the string lengths before the
std::string::compare call in std::string::operator==/!= would avoid
doing a byte-for-byte comparison in most cases where unequal strings
are compared.

A quick glance at the object code shows that the new conditional
replaces the std::min in std::string::compare in addition to reducing
the code size slightly, when compiled with -O2.

Or is there some specific reasons why this isn't done?

Jari Sundell

Reply via email to