Ver Fonte

String: Define operator>(String)

Andreas Kling há 5 anos atrás
pai
commit
96f9e6a64f
1 ficheiros alterados com 11 adições e 0 exclusões
  1. 11 0
      AK/String.cpp

+ 11 - 0
AK/String.cpp

@@ -44,6 +44,17 @@ bool String::operator<(const String& other) const
     return strcmp(characters(), other.characters()) < 0;
     return strcmp(characters(), other.characters()) < 0;
 }
 }
 
 
+bool String::operator>(const String& other) const
+{
+    if (!m_impl)
+        return other.m_impl;
+
+    if (!other.m_impl)
+        return false;
+
+    return strcmp(characters(), other.characters()) > 0;
+}
+
 String String::empty()
 String String::empty()
 {
 {
     return StringImpl::the_empty_stringimpl();
     return StringImpl::the_empty_stringimpl();