From 6963e7f973c09e0fcc4dd12e98b0796a7047ec09 Mon Sep 17 00:00:00 2001 From: Sven Oesau Date: Thu, 5 Oct 2023 13:57:01 +0200 Subject: [PATCH] fix emplace_group on MSVC --- Property_map/include/CGAL/Property_container.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Property_map/include/CGAL/Property_container.h b/Property_map/include/CGAL/Property_container.h index 35887a1ee43..83d6e81cde2 100644 --- a/Property_map/include/CGAL/Property_container.h +++ b/Property_map/include/CGAL/Property_container.h @@ -106,7 +106,7 @@ public: } virtual void move(Property_array_base&& other_base) override { - auto&& other = dynamic_cast&&>(other_base); + auto&& other = static_cast&&>(other_base); m_data = std::move(other.m_data); CGAL_precondition(m_active_indices.size() == m_data.size()); } @@ -489,10 +489,13 @@ public: [](bool used) { return !used; } ); + auto unused_end = unused_begin; + // Determine if the group fits - auto unused_end = std::find_if( - unused_begin, std::min(unused_begin + n, m_active_indices.end()), - [](bool used) { return used; } + if (std::distance(unused_begin, m_active_indices.end()) >= n) + unused_end = std::find_if( + unused_begin, std::min(unused_begin + n, m_active_indices.end()), + [](bool used) { return used; } ); // If the discovered range was large enough