From 2f3aaa63b93aa9babf332462a92c2a5c0779e88c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 25 Jul 2017 08:19:03 +0200 Subject: [PATCH] make random accessor working even if the base container is not random access --- Polygon/include/CGAL/Polygon_2.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Polygon/include/CGAL/Polygon_2.h b/Polygon/include/CGAL/Polygon_2.h index 7623916b0a5..abc2805a2fb 100644 --- a/Polygon/include/CGAL/Polygon_2.h +++ b/Polygon/include/CGAL/Polygon_2.h @@ -35,6 +35,7 @@ #include #include +#include #include #include @@ -423,7 +424,7 @@ class Polygon_2 { /// Returns a (const) reference to the `i`-th vertex. const Point_2& vertex(std::size_t i) const - { return *(d_container.begin() + i); } + { return *(cpp11::next(d_container.begin(), i)); } /// Returns a (const) reference to the `i`-th vertex. @@ -432,7 +433,7 @@ class Polygon_2 { /// Returns the `i`-th edge. Segment_2 edge(std::size_t i) const - { return *(edges_begin() + i); } + { return *(cpp11::next(edges_begin(), i)); } /// @}