From 5168f567422461b39f6ed6a8ba53c17b3c6f3627 Mon Sep 17 00:00:00 2001 From: artem-ogre Date: Mon, 13 Nov 2023 15:26:09 +0100 Subject: [PATCH] #162 Fix code to avoid overly aggressive -Wshadow warnings with constructor parameters --- CDT/include/Triangulation.hpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/CDT/include/Triangulation.hpp b/CDT/include/Triangulation.hpp index 3d78897..d71cbe4 100644 --- a/CDT/include/Triangulation.hpp +++ b/CDT/include/Triangulation.hpp @@ -1906,29 +1906,33 @@ class FixedCapacityQueue }; template -struct less_than_x +class less_than_x { + const std::vector >& m_vertices; + +public: less_than_x(const std::vector >& vertices) - : vertices(vertices) + : m_vertices(vertices) {} bool operator()(const VertInd a, const VertInd b) const { - return vertices[a].x < vertices[b].x; + return m_vertices[a].x < m_vertices[b].x; } - const std::vector >& vertices; }; template -struct less_than_y +class less_than_y { + const std::vector >& m_vertices; + +public: less_than_y(const std::vector >& vertices) - : vertices(vertices) + : m_vertices(vertices) {} bool operator()(const VertInd a, const VertInd b) const { - return vertices[a].y < vertices[b].y; + return m_vertices[a].y < m_vertices[b].y; } - const std::vector >& vertices; }; } // namespace detail