From 43235a1ac20d55fa50361b4ee51621804f530eb6 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Fri, 20 Sep 2024 23:49:16 +0200 Subject: [PATCH] Fixed CentOS7 builds --- src/db/db/dbPolygonGenerators.cc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/db/db/dbPolygonGenerators.cc b/src/db/db/dbPolygonGenerators.cc index ddaf33268..621979b02 100644 --- a/src/db/db/dbPolygonGenerators.cc +++ b/src/db/db/dbPolygonGenerators.cc @@ -182,15 +182,18 @@ class PGPolyContour template iterator insert (iterator at, I from, I to) { - m_size += std::distance (from, to); -#if 0 // NOTE: in some STL m_contour.insert already returns the new iterator - size_t index_at = at - m_contour.begin (); - m_contour.insert (at, from, to); - return m_contour.begin () + index_at; -#else - return m_contour.insert (at, from, to); -#endif + // For CentOS7 we compute the result explicitly + m_size += std::distance (from, to); + if (at == m_contour.begin ()) { + m_contour.insert (at, from, to); + return m_contour.begin (); + } else { + iterator prev = at; + --prev; + m_contour.insert (at, from, to); + return ++prev; + } } private: