From 55374d78ed748f41dcdab2e75aab8f13f4ea3cdf Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sat, 25 Jul 2026 16:14:37 +1000 Subject: [PATCH] svgfill: use std::optional instead of transitive boost::optional Graph2D::query and arrange_polygons relied on boost::optional reaching them transitively through CGAL/boost headers. That transitive include no longer happens on newer toolchains (GCC 14 / newer libstdc++), so the build breaks with "boost::optional does not name a template type". The rest of the svgfill module already uses std::optional; migrate these two holdouts to match and include explicitly rather than freeload on a fragile transitive include. Co-Authored-By: Claude Opus 4.8 --- src/svgfill/src/arrange_polygons.cpp | 11 ++++++----- src/svgfill/src/graph_2d.h | 6 ++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/svgfill/src/arrange_polygons.cpp b/src/svgfill/src/arrange_polygons.cpp index 55fb2cbd32..4281571f26 100644 --- a/src/svgfill/src/arrange_polygons.cpp +++ b/src/svgfill/src/arrange_polygons.cpp @@ -25,6 +25,7 @@ #include #include +#include #include "graph_2d.h" @@ -2313,8 +2314,8 @@ extend_end_vertices_based_on_input_simple( CGAL::Ray_2 ray(incoming, M - incoming); // intersect ray with boundary - boost::optional> closest_segment; - boost::optional> closest_intersection_point; + std::optional> closest_segment; + std::optional> closest_intersection_point; K::FT sq_distance_along_ray = std::numeric_limits::infinity(); for (auto jt = bnd.edges_begin(); jt != bnd.edges_end(); ++jt) { const auto& seg = *jt; @@ -2345,7 +2346,7 @@ extend_end_vertices_based_on_input_simple( // Loop over boundary segments, and project point onto it, take the closest K::FT closest_distance = std::numeric_limits::infinity(); - boost::optional> closest_point; + std::optional> closest_point; for (auto& poly : outer_perimiter) { for (auto jt = poly.edges_begin(); jt != poly.edges_end(); ++jt) { auto seg = *jt; @@ -2395,7 +2396,7 @@ extend_end_vertices_based_on_input_simple( } } } else if (bnd.has_on_boundary(M)) { - return boost::optional{M}; + return std::optional{M}; } } if (within_any_perimeter) { @@ -2403,7 +2404,7 @@ extend_end_vertices_based_on_input_simple( } else { logger.message(::logger::LOG_WARNING, "ARR", 3, "Point is outside all boundaries"); } - return boost::optional{}; + return std::optional{}; }; using solution_length_point_incoming = std::tuple; diff --git a/src/svgfill/src/graph_2d.h b/src/svgfill/src/graph_2d.h index 76d8200d4c..e5601f6dea 100644 --- a/src/svgfill/src/graph_2d.h +++ b/src/svgfill/src/graph_2d.h @@ -7,6 +7,8 @@ #endif #endif +#include + template class Graph2D { public: @@ -56,8 +58,8 @@ public: return adjacency_list.find(p); } - boost::optional< CGAL::Segment_2 > query(const Point_2& p, typename Kernel::FT eps) { - boost::optional< CGAL::Segment_2 > closest_segment; + std::optional< CGAL::Segment_2 > query(const Point_2& p, typename Kernel::FT eps) { + std::optional< CGAL::Segment_2 > closest_segment; typename Kernel::FT closest_distance = std::numeric_limits::infinity(); for (auto& p1 : adjacency_list) { for (auto& p2 : p1.second) {