diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index b40e7a0..566f39c 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -30,7 +30,7 @@ jobs: cache: 'pip' cache-dependency-path: '${{ github.workspace }}/doc/requirements.txt' - name: Install Python Dependencies - run: python -m pip install -r repo/polyops/doc/requirements.txt + run: python -m pip install -r ${{ github.workspace }}/doc/requirements.txt - name: Install Doxygen uses: awalsh128/cache-apt-pkgs-action@latest with: diff --git a/include/poly_ops/base.hpp b/include/poly_ops/base.hpp index b184dbf..bff039a 100644 --- a/include/poly_ops/base.hpp +++ b/include/poly_ops/base.hpp @@ -302,7 +302,7 @@ template struct point_t { /** Construct `point_t` from any point-like object */ template U> constexpr point_t(const U &b) - noexcept(noexcept(point_t(point_ops::get_x(b)),point_ops::get_y(b))) + noexcept(noexcept(point_t(point_ops::get_x(b),point_ops::get_y(b)))) : _data{point_ops::get_x(b),point_ops::get_y(b)} {} constexpr point_t &operator=(const point_t &b) noexcept(std::is_nothrow_copy_constructible_v) = default; diff --git a/include/poly_ops/clip.hpp b/include/poly_ops/clip.hpp index c36ab2d..84e48d1 100644 --- a/include/poly_ops/clip.hpp +++ b/include/poly_ops/clip.hpp @@ -144,8 +144,8 @@ template struct null_tracker; /** * `null_tracker` is stateless. The clipper data types use - * `[[no_unique_address]]` after pointers to trackers, so an empty struct is - * used instead of a real pointer for `null_tracker`. + * `[[no_unique_address]]` on pointers to trackers, so an empty struct is used + * instead of a real pointer for `null_tracker`. */ template struct null_tracker_ptr { null_tracker operator*() const noexcept; @@ -1419,10 +1419,10 @@ template struct tracked_points { - Tracker _tracker; - [[no_unique_address]] LPoints lpoints; + [[no_unique_address]] Tracker _tracker; + LPoints lpoints; - auto tracker() noexcept { + auto tracker() const noexcept { if constexpr(IsPtr) { return _tracker; } else { return &_tracker; } } @@ -1509,6 +1509,13 @@ template struct range_facade { auto begin() noexcept { return iterator_facade,F>{std::ranges::begin(base),&fun}; } auto end() noexcept { return iterator_facade,F>{std::ranges::end(base),&fun}; } + + auto begin() const noexcept requires std::is_invocable_v> { + return iterator_facade,const F>{std::ranges::begin(base),&fun}; + } + auto end() const noexcept requires std::is_invocable_v> { + return iterator_facade,const F>{std::ranges::end(base),&fun}; + } }; template range_facade(R &&base,F &&fun) @@ -1524,7 +1531,7 @@ auto make_temp_polygon_tree_range( return range_facade( top, [tl=make_tracked_points(tracker,lpoints)] - (const temp_polygon *poly) mutable { + (const temp_polygon *poly) { return temp_polygon_proxy(tl.lpoints,*poly,tl.tracker()); }); } @@ -1543,8 +1550,8 @@ template; - tracker_ptr tracker; - [[no_unique_address]] const detail::loop_point *lpoints; + [[no_unique_address]] tracker_ptr tracker; + const detail::loop_point *lpoints; Index i; /* Loops have the same "i" value for "begin()" and "end()" thus a different @@ -1626,7 +1633,7 @@ class temp_polygon_proxy : public std::ranges::view_interface(lpoints,data.children,tracker); + return detail::make_temp_polygon_tree_range(lpoints,data.children,*tracker); } }; @@ -1649,7 +1656,7 @@ template auto make_temp_polygon_ return range_facade( std::move(top), [tl=make_tracked_points(std::forward(tracker),std::move(lpoints)),loops=std::move(loops)] - (const temp_polygon *poly) mutable { + (const temp_polygon *poly) { return temp_polygon_proxy(tl.lpoints.data(),*poly,tl.tracker()); }); } @@ -1662,7 +1669,7 @@ template auto make_temp_polygon_ return range_facade( std::move(loops), [tl=make_tracked_points(std::forward(tracker),std::move(lpoints))] - (const temp_polygon &poly) mutable { + (const temp_polygon &poly) { return temp_polygon_proxy(tl.lpoints.data(),poly,tl.tracker()); }); } @@ -1675,7 +1682,7 @@ template auto make_temp_polygon_ return range_facade( loops, [tl=make_tracked_points(std::forward(tracker),lpoints.data())] - (const temp_polygon &poly) mutable { + (const temp_polygon &poly) { return temp_polygon_proxy(tl.lpoints,poly,tl.tracker()); }); } @@ -2368,8 +2375,8 @@ void clipper::reset() { */ template Tracker> class tclipper { public: - Tracker tracker; - [[no_unique_address]] clipper base; + [[no_unique_address]] Tracker tracker; + clipper base; explicit tclipper(std::pmr::memory_resource *_contig_mem=nullptr) requires(std::is_default_constructible_v) : base{_contig_mem} {}