Skip to content

Commit a8c85f5

Browse files
committed
SafePointer: Add new equality operators to avoid ambiguous operator warnings with clang 14
1 parent 17bf5c1 commit a8c85f5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

modules/juce_gui_basics/components/juce_Component.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2414,6 +2414,9 @@ class JUCE_API Component : public MouseListener
24142414
/** If the component is valid, this deletes it and sets this pointer to null. */
24152415
void deleteAndZero() { delete std::exchange (weakRef, nullptr); }
24162416

2417+
bool operator== (SafePointer other) const noexcept { return weakRef == other.weakRef; }
2418+
bool operator!= (SafePointer other) const noexcept { return ! operator== (other); }
2419+
24172420
bool operator== (ComponentType* component) const noexcept { return weakRef == component; }
24182421
bool operator!= (ComponentType* component) const noexcept { return weakRef != component; }
24192422

0 commit comments

Comments
 (0)