From a9ec6351607b21eca46129515814746e561152d1 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 20 Jun 2020 03:49:38 -0500 Subject: [PATCH] [ox/std] Make String comparison operators const correct --- deps/ox/src/ox/std/string.cpp | 4 ++-- deps/ox/src/ox/std/string.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/deps/ox/src/ox/std/string.cpp b/deps/ox/src/ox/std/string.cpp index 18d1b9bb..ba1342ed 100644 --- a/deps/ox/src/ox/std/string.cpp +++ b/deps/ox/src/ox/std/string.cpp @@ -125,7 +125,7 @@ const String String::operator+(const String &src) const noexcept { return *this + src.c_str(); } -bool String::operator==(const String &other) noexcept { +bool String::operator==(const String &other) const noexcept { bool retval = true; std::size_t i = 0; while (i < m_buff.size() && (m_buff[i] || other.m_buff[i])) { @@ -138,7 +138,7 @@ bool String::operator==(const String &other) noexcept { return retval; } -bool String::operator!=(const String &other) noexcept { +bool String::operator!=(const String &other) const noexcept { return !operator==(other); } diff --git a/deps/ox/src/ox/std/string.hpp b/deps/ox/src/ox/std/string.hpp index 67b468e5..46568cc9 100644 --- a/deps/ox/src/ox/std/string.hpp +++ b/deps/ox/src/ox/std/string.hpp @@ -59,9 +59,9 @@ class String { const String operator+(const String &src) const noexcept; - bool operator==(const String &other) noexcept; + bool operator==(const String &other) const noexcept; - bool operator!=(const String &other) noexcept; + bool operator!=(const String &other) const noexcept; char operator[](std::size_t i) const noexcept;