From 30b0b74752c2a8417caa379079027f3b8f2e2d6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arseni=20=C5=BBarkiewicz?= <151842641+ArseniZar@users.noreply.github.com> Date: Tue, 11 Aug 2026 13:19:58 +0200 Subject: [PATCH] update(StringN): add comparison operator (==) (!=) --- src/StringN.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/StringN.h b/src/StringN.h index 66229e3..c7e5144 100644 --- a/src/StringN.h +++ b/src/StringN.h @@ -76,6 +76,17 @@ class StringN { return add(val); } + template + bool operator==(const StringN& other) const { + if (_len != other._len) return false; + return memcmp(_buf, other._buf, _len) == 0; + } + + template + bool operator!=(const StringN& other) const { + return !(*this == other); + } + // ============== StringN ============== template StringN& add(const StringN& str) {