make random accessor working even if the base container is not random access

This commit is contained in:
Sébastien Loriot 2017-07-25 08:19:03 +02:00
parent cc65b11d6d
commit 2f3aaa63b9
1 changed files with 3 additions and 2 deletions

View File

@ -35,6 +35,7 @@
#include <list>
#include <iterator>
#include <CGAL/algorithm.h>
#include <CGAL/circulator.h>
#include <CGAL/enum.h>
@ -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)); }
/// @}