// Copyright (c) 1997-2002 Max-Planck-Institute Saarbruecken (Germany). // All rights reserved. // // This file is part of CGAL (www.cgal.org). // // $URL: https://github.com/CGAL/cgal/blob/v5.2/Nef_2/include/CGAL/Nef_2/iterator_tools.h $ // $Id: iterator_tools.h 9d16a42 2020-06-15T17:07:35+02:00 Laurent Rineau // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // // Author(s) : Michael Seel #ifndef CGAL_ITERATORTOOLS_H #define CGAL_ITERATORTOOLS_H #include #include #include namespace CGAL { template class CircFromIt : public Iter { // Ptr node; // The internal node ptr inherited from It. typedef CircFromIt Self; public: typedef typename Iter::iterator_category Icategory; typedef I_Circulator_from_iterator_traits CTraits; typedef typename CTraits::iterator_category iterator_category; CircFromIt() : Iter(0) {} CircFromIt(Iter i) : Iter(i) {} // OPERATIONS Forward Category // --------------------------- bool operator==( std::nullptr_t CGAL_assertion_code(p) ) const { CGAL_assertion( p == nullptr ); return Iter::operator==( Iter(nullptr) ); } bool operator!=( std::nullptr_t p ) const { return !(*this == p); } bool operator==( const Self& i ) const { return Iter::operator==(i); } bool operator!=( const Self& i) const { return !(*this == i); } bool operator==( const Iter& i ) const { return Iter::operator==(i); } bool operator!=( const Iter& i) const { return !(*this == i); } Self& operator++() { Move move; move.forward(*this); return *this; } Self operator++(int) { CircFromIt tmp = *this; ++*this; return tmp; } // OPERATIONS Bidirectional Category // --------------------------------- Self& operator--() { Move move; move.backward(*this); return *this; } Self operator--(int) { CircFromIt tmp = *this; --*this; return tmp; } }; template class PntItFromVertIt : public Iter { public: typedef PntItFromVertIt Self; typedef Iter Base; typedef Pnt value_type; typedef const Pnt* pointer; typedef const Pnt& reference; PntItFromVertIt() : Base() {} PntItFromVertIt(Iter it) : Base(it) {} PntItFromVertIt(const Self& it) : Base(it) {} reference operator*() const { return Base::operator*().point(); } pointer operator->() const { return &(operator*()); } Self& operator++() { return (Self&)Base::operator++(); } Self operator++(int) { Self tmp=*this; ++*this; return tmp; } }; template std::string PH(H h) { if (h == H()) return "nil"; return h->debug(); } } //namespace CGAL #endif // CGAL_ITERATORTOOLS_H