PIConstChars PIMap supports

This commit is contained in:
2022-04-30 00:07:58 +03:00
parent 6881fd13b7
commit 4139d88103
2 changed files with 8 additions and 4 deletions

View File

@@ -130,8 +130,9 @@ public:
//! \~english Compare operator. //! \~english Compare operator.
//! \~russian Оператор сравнения. //! \~russian Оператор сравнения.
inline bool operator <(const PIConstChars & s) const { inline bool operator <(const PIConstChars & s) const {
if (isNull() && s.isNull()) return false; if ( isNull() && s.isNull()) return false;
if (isNull() xor s.isNull()) return false; if ( isNull() && !s.isNull()) return true ;
if (!isNull() && s.isNull()) return false;
if (size() == s.size()) if (size() == s.size())
return strcmp(str, s.str) < 0; return strcmp(str, s.str) < 0;
return size() < s.size(); return size() < s.size();
@@ -140,8 +141,9 @@ public:
//! \~english Compare operator. //! \~english Compare operator.
//! \~russian Оператор сравнения. //! \~russian Оператор сравнения.
inline bool operator >(const PIConstChars & s) const { inline bool operator >(const PIConstChars & s) const {
if (isNull() && s.isNull()) return false; 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 (size() == s.size()) if (size() == s.size())
return strcmp(str, s.str) > 0; return strcmp(str, s.str) > 0;
return size() > s.size(); return size() > s.size();

View File

@@ -39,6 +39,8 @@ int main(int argc, char * argv[]) {
cmp(PIConstChars("1c"), PIConstChars("1b"));*/ cmp(PIConstChars("1c"), PIConstChars("1b"));*/
PIMap<PIConstChars, int> map; PIMap<PIConstChars, int> map;
map[PIConstChars()] = 0;
map[PIConstChars()] = -1;
map["_2"] = 22; map["_2"] = 22;
map["1"] = 11; map["1"] = 11;
map["__3"] = 33; map["__3"] = 33;