From 2e476304ede1bdf582a7c09b1e01f70fb80ee226 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 10 Nov 2021 09:28:05 +0100 Subject: [PATCH] Fix warnings > CGAL/Voronoi_diagram_2/Connected_components.h:103:19: warning: ISO C++20 considers use of overloaded operator '!=' (with operand types 'CGAL::VoronoiDiagram_2::Internal::Connected_components<...>::HAVC') to be ambiguous despite there being a unique best viable function with non-reversed arguments [-Wambiguous-reversed-operator] I changed `operator==` into friend functions. --- .../CGAL/Voronoi_diagram_2/Circulator_adaptors.h | 8 ++++---- .../CGAL/Voronoi_diagram_2/Iterator_adaptors.h | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Circulator_adaptors.h b/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Circulator_adaptors.h index b14991c03f3..6b2c567866b 100644 --- a/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Circulator_adaptors.h +++ b/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Circulator_adaptors.h @@ -71,13 +71,13 @@ class Circulator_from_halfedge_adaptor typename Base::pointer operator->() { return &cur_; } typename Base::reference operator*() { return cur_; } - bool operator==(const Circulator& other) const { - return cur_ == other.cur_; + friend bool operator==(const Circulator& c, const Circulator& other) { + return c.cur_ == other.cur_; } - bool operator!=(const Circulator& other) const { - return cur_ != other.cur_; + friend bool operator!=(const Circulator& c, const Circulator& other) { + return c.cur_ != other.cur_; } protected: diff --git a/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Iterator_adaptors.h b/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Iterator_adaptors.h index d88aae38e88..7efc4d6429f 100644 --- a/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Iterator_adaptors.h +++ b/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Iterator_adaptors.h @@ -85,13 +85,13 @@ class Iterator_adaptor_base return tmp; } - bool operator==(const Iterator& other) const { + bool operator==(const Self& other) const { if ( vda_ == nullptr ) { return other.vda_ == nullptr; } if ( other.vda_ == nullptr ) { return vda_ == nullptr; } return ( vda_ == other.vda_ && cur_ == other.cur_ ); } - bool operator!=(const Iterator& other) const { + bool operator!=(const Self& other) const { return !(*this == other); } @@ -235,12 +235,12 @@ private: return *this; } - bool operator==(const Self& other) const { - return Base::operator==(other) && is_first_ == other.is_first_; + friend bool operator==(const Self& i, const Self& other) { + return i.Base::operator==(other) && i.is_first_ == other.is_first_; } - bool operator!=(const Self& other) const { - return !(*this == other); + friend bool operator!=(const Self& i, const Self& other) { + return !(i == other); } private: