From 4139d88103fbd8d8acb0e4f6ff220285bbcc3ec8 Mon Sep 17 00:00:00 2001 From: peri4 Date: Sat, 30 Apr 2022 00:07:58 +0300 Subject: [PATCH] PIConstChars PIMap supports --- libs/main/core/piconstchars.h | 10 ++++++---- main.cpp | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libs/main/core/piconstchars.h b/libs/main/core/piconstchars.h index 5aff7412..af99701a 100644 --- a/libs/main/core/piconstchars.h +++ b/libs/main/core/piconstchars.h @@ -130,8 +130,9 @@ public: //! \~english Compare operator. //! \~russian Оператор сравнения. inline bool operator <(const PIConstChars & s) const { - if (isNull() && s.isNull()) return false; - if (isNull() xor s.isNull()) return false; + if ( isNull() && s.isNull()) return false; + if ( isNull() && !s.isNull()) return true ; + if (!isNull() && s.isNull()) return false; if (size() == s.size()) return strcmp(str, s.str) < 0; return size() < s.size(); @@ -140,8 +141,9 @@ public: //! \~english Compare operator. //! \~russian Оператор сравнения. inline bool operator >(const PIConstChars & s) const { - if (isNull() && s.isNull()) return false; - if (isNull() xor s.isNull()) return false; + if ( isNull() && s.isNull()) return false; + if ( isNull() && !s.isNull()) return false; + if (!isNull() && s.isNull()) return true ; if (size() == s.size()) return strcmp(str, s.str) > 0; return size() > s.size(); diff --git a/main.cpp b/main.cpp index 6b1e75c0..690214fd 100644 --- a/main.cpp +++ b/main.cpp @@ -39,6 +39,8 @@ int main(int argc, char * argv[]) { cmp(PIConstChars("1c"), PIConstChars("1b"));*/ PIMap map; + map[PIConstChars()] = 0; + map[PIConstChars()] = -1; map["_2"] = 22; map["1"] = 11; map["__3"] = 33;