From dc70a04100fd491151d3478a05ecf8baecfa894c Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Wed, 10 Jan 2024 21:32:02 -0800 Subject: Add Fl_String not-equal test --- src/Fl_String.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/Fl_String.cxx') diff --git a/src/Fl_String.cxx b/src/Fl_String.cxx index 8fd8e5f51..60d50ef99 100644 --- a/src/Fl_String.cxx +++ b/src/Fl_String.cxx @@ -645,6 +645,19 @@ bool operator==(const Fl_String &lhs, const Fl_String &rhs) { return false; } +/** + Compare two strings for inequality. + \param[in] lhs first string + \param[in] rhs second string + \return true if strings differ in size or content + */ +bool operator!=(const Fl_String &lhs, const Fl_String &rhs) { + if (lhs.size() != rhs.size()) return true; + int sz = lhs.size(); // same size for both + if (memcmp(lhs.data(), rhs.data(), sz) != 0) return true; + return false; +} + /** \} \endcond -- cgit v1.2.3