From 96f9e6a64fdc04aa852f1cd8368feaf736712f27 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 19 Oct 2019 20:50:55 +0200 Subject: [PATCH] String: Define operator>(String) --- AK/String.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/AK/String.cpp b/AK/String.cpp index 665936af54..d20193685f 100644 --- a/AK/String.cpp +++ b/AK/String.cpp @@ -44,6 +44,17 @@ bool String::operator<(const String& other) const 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() { return StringImpl::the_empty_stringimpl();