Browse Source

explicit comparison operators needed

David Rose 19 năm trước cách đây
mục cha
commit
0e1ea07313
2 tập tin đã thay đổi với 23 bổ sung0 xóa
  1. 20 0
      panda/src/express/pointerToVoid.I
  2. 3 0
      panda/src/express/pointerToVoid.h

+ 20 - 0
panda/src/express/pointerToVoid.I

@@ -89,3 +89,23 @@ operator < (const PointerToVoid &other) const {
   return _void_ptr < other._void_ptr;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: PointerToVoid::operator ==
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE bool PointerToVoid::
+operator == (const PointerToVoid &other) const {
+  return _void_ptr == other._void_ptr;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PointerToVoid::operator !=
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE bool PointerToVoid::
+operator != (const PointerToVoid &other) const {
+  return _void_ptr != other._void_ptr;
+}
+

+ 3 - 0
panda/src/express/pointerToVoid.h

@@ -52,6 +52,9 @@ public:
   INLINE bool operator < (const void *other) const;
   INLINE bool operator < (const PointerToVoid &other) const;
 
+  INLINE bool operator == (const PointerToVoid &other) const;
+  INLINE bool operator != (const PointerToVoid &other) const;
+
 protected:
   // Within the PointerToVoid class, we only store a void pointer.
   // This is actually the (To *) pointer that is typecast to (void *)