diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index b7b1f359e36..8ce4c1e13f9 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -123,9 +123,7 @@ namespace CGAL { /// decrement. SM_Index operator--(int) { SM_Index tmp(*this); --idx_; return tmp; } - - - + SM_Index operator+=(std::ptrdiff_t n) { idx_ += n; return *this; } private: size_type idx_; @@ -463,12 +461,12 @@ private: //------------------------------------------------------ iterator types class Index_iterator : public boost::iterator_facade< Index_iterator, Index_, - std::bidirectional_iterator_tag + std::random_access_iterator_tag > { typedef boost::iterator_facade< Index_iterator, Index_, - std::bidirectional_iterator_tag + std::random_access_iterator_tag > Facade; public: Index_iterator() : hnd_(), mesh_(NULL) {} @@ -497,6 +495,18 @@ private: //------------------------------------------------------ iterator types while ( mesh_->has_valid_index(hnd_) && mesh_->is_removed(hnd_)) --hnd_; } + void advance(std::ptrdiff_t n) + { + CGAL_assertion(mesh_ != NULL); + CGAL_assertion(!(mesh_->has_garbage())); + hnd_ += n; + } + + std::ptrdiff_t distance_to(const Index_iterator& other) const + { + return std::ptrdiff_t(other.hnd_) - std::ptrdiff_t(this->hnd_); + } + bool equal(const Index_iterator& other) const { return this->hnd_ == other.hnd_;