This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I've just committed this, and then noticed that we don't do the same optimization for basic_string unless the char_type is char. Presumably this is so that we do call basic_string::compare() and so call any user-defined traits_type::eq() function (which is observable). I don't think that's necessary, because the standard says operator== on strings returns the result of lhs.compare(rhs) == 0, not that it's "Equivalent to" such a call. As long as we give the right answer, I don't think we need to make an explicit call to basic_string::compare(). So maybe we want this for basic_string too. PR libstdc++/79206 * include/experimental/string_view (operator==): Check sizes first. * include/std/string_view (operator==): Likewise. Tested powerpc64le-linux, committed to trunk.
Attachment:
patch.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |