summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/base.h10
-rw-r--r--include/class.h6
2 files changed, 8 insertions, 8 deletions
diff --git a/include/base.h b/include/base.h
index e99023b..d0e7e71 100644
--- a/include/base.h
+++ b/include/base.h
@@ -220,18 +220,14 @@ public:
virtual bool __toBool();
/**
- * Compare the object with a different object of the same type
+ * Comparison operator
*
- * This method should return 0 if both objects are equal, a negative value
- * if the 'this' object is smaller, and a positive value if the 'this'
- * object is bigger.
- *
- * The passed in object is an instance of base
+ * Check how a different object compares to this object
*
* @param that Object to compare with
* @return int
*/
- virtual bool __compare(const Base &that) const;
+ bool operator<(const Base &that) const;
private:
diff --git a/include/class.h b/include/class.h
index eabcec6..427aa64 100644
--- a/include/class.h
+++ b/include/class.h
@@ -197,7 +197,11 @@ private:
T *t2 = (T *)object2;
// compare the two objects
- return t1->__compare(*t2);
+ if (*t1 < *t2) return -1;
+ if (*t1 > *t2) return 1;
+
+ // they must be identical
+ return 0;
}
/**