PIConstChars PIMap supports
This commit is contained in:
@@ -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();
|
||||||
|
|||||||
2
main.cpp
2
main.cpp
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user