From a8c85f59692efca4ab181230c474c75f6aa27367 Mon Sep 17 00:00:00 2001 From: reuk Date: Mon, 14 Apr 2025 13:05:28 +0100 Subject: [PATCH] SafePointer: Add new equality operators to avoid ambiguous operator warnings with clang 14 --- modules/juce_gui_basics/components/juce_Component.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/juce_gui_basics/components/juce_Component.h b/modules/juce_gui_basics/components/juce_Component.h index b9471a560d..da4faf6191 100644 --- a/modules/juce_gui_basics/components/juce_Component.h +++ b/modules/juce_gui_basics/components/juce_Component.h @@ -2414,6 +2414,9 @@ public: /** If the component is valid, this deletes it and sets this pointer to null. */ void deleteAndZero() { delete std::exchange (weakRef, nullptr); } + bool operator== (SafePointer other) const noexcept { return weakRef == other.weakRef; } + bool operator!= (SafePointer other) const noexcept { return ! operator== (other); } + bool operator== (ComponentType* component) const noexcept { return weakRef == component; } bool operator!= (ComponentType* component) const noexcept { return weakRef != component; }