Inline StringRef::operator==

This enables its inlining even without LTO, which in turns enables
callers to determine that two StringRefs are unequals with simple
comparison of two numbers, without any function calls.
This commit is contained in:
Martin Hořeňovský
2023-02-20 15:05:09 +01:00
parent 2befd98da2
commit e1dbad4c9e
2 changed files with 6 additions and 5 deletions
-4
View File
@@ -17,10 +17,6 @@ namespace Catch {
: StringRef( rawChars, std::strlen(rawChars) )
{}
auto StringRef::operator == ( StringRef other ) const noexcept -> bool {
return m_size == other.m_size
&& (std::memcmp( m_start, other.m_start, m_size ) == 0);
}
bool StringRef::operator<(StringRef rhs) const noexcept {
if (m_size < rhs.m_size) {