mirror of https://github.com/CGAL/cgal
make random accessor working even if the base container is not random access
This commit is contained in:
parent
cc65b11d6d
commit
2f3aaa63b9
|
|
@ -35,6 +35,7 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
|
#include <CGAL/algorithm.h>
|
||||||
#include <CGAL/circulator.h>
|
#include <CGAL/circulator.h>
|
||||||
#include <CGAL/enum.h>
|
#include <CGAL/enum.h>
|
||||||
|
|
||||||
|
|
@ -423,7 +424,7 @@ class Polygon_2 {
|
||||||
|
|
||||||
/// Returns a (const) reference to the `i`-th vertex.
|
/// Returns a (const) reference to the `i`-th vertex.
|
||||||
const Point_2& vertex(std::size_t i) const
|
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.
|
/// Returns a (const) reference to the `i`-th vertex.
|
||||||
|
|
@ -432,7 +433,7 @@ class Polygon_2 {
|
||||||
|
|
||||||
/// Returns the `i`-th edge.
|
/// Returns the `i`-th edge.
|
||||||
Segment_2 edge(std::size_t i) const
|
Segment_2 edge(std::size_t i) const
|
||||||
{ return *(edges_begin() + i); }
|
{ return *(cpp11::next(edges_begin(), i)); }
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue