Regina Calculation Engine
Public Member Functions | List of all members
regina::CrossingIterator Class Reference


Iterates through all crossings of a link. More...

#include <link/link.h>

Public Member Functions

 CrossingIterator ()
 Creates a singular iterator. More...
 
 CrossingIterator (const CrossingIterator &)=default
 Default copy constructor. More...
 
 CrossingIterator (const Link &link, size_t index=0)
 Creates a new iterator pointing to the given crossing of the given link. More...
 
CrossingIteratoroperator++ ()
 Preincrement operator. More...
 
CrossingIterator operator++ (int)
 Postincrement operator. More...
 
Crossingoperator* () const
 Returns the crossing to which this iterator points. More...
 
CrossingIteratoroperator= (const CrossingIterator &)=default
 Default assignment operator. More...
 
bool operator== (const CrossingIterator &rhs) const
 Tests whether this and the given iterator are equal. More...
 
bool operator!= (const CrossingIterator &rhs) const
 Tests whether this and the given iterator are different. More...
 

Detailed Description


Iterates through all crossings of a link.

The order of iteration follows the indexing of the crossings from 0 to Link::size()-1.

This class implements the Boost multipass input iterator concept, which is similar to the standard C++ forward iterator except that the reference type may be the same as value_type (and so, in particular, the dereference operator may return by value). This header also specialises std::iterator_traits for this iterator type.

Python
Not present.

Constructor & Destructor Documentation

◆ CrossingIterator() [1/3]

regina::CrossingIterator::CrossingIterator ( )
inline

Creates a singular iterator.

◆ CrossingIterator() [2/3]

regina::CrossingIterator::CrossingIterator ( const CrossingIterator )
default

Default copy constructor.

◆ CrossingIterator() [3/3]

regina::CrossingIterator::CrossingIterator ( const Link link,
size_t  index = 0 
)
inline

Creates a new iterator pointing to the given crossing of the given link.

Parameters
linkthe underlying knot/link.
indexthe index of the crossing to point to. This must be between 0 and link.size()-1 for a deferencable iterator, or must be exactly link.size() for a past-the-end iterator.

Member Function Documentation

◆ operator!=()

bool regina::CrossingIterator::operator!= ( const CrossingIterator rhs) const
inline

Tests whether this and the given iterator are different.

Note
This routine only compares the indices of the crossings. It does not examine whether this and the given iterator refer to the same underlying link.
Parameters
rhsthe iterator to compare with this.
Returns
true if and only if the two iterators are different.

◆ operator*()

Crossing * regina::CrossingIterator::operator* ( ) const
inline

Returns the crossing to which this iterator points.

Precondition
This iterator is not past-the-end.
Returns
the crossing to which this iterator points.

◆ operator++() [1/2]

CrossingIterator & regina::CrossingIterator::operator++ ( )
inline

Preincrement operator.

Returns
a reference to this iterator.

◆ operator++() [2/2]

CrossingIterator regina::CrossingIterator::operator++ ( int  )
inline

Postincrement operator.

Returns
a copy of this iterator before it was incremented.

◆ operator=()

CrossingIterator& regina::CrossingIterator::operator= ( const CrossingIterator )
default

Default assignment operator.

Returns
a reference to this iterator.

◆ operator==()

bool regina::CrossingIterator::operator== ( const CrossingIterator rhs) const
inline

Tests whether this and the given iterator are equal.

Note
This routine only compares the indices of the crossings. It does not examine whether this and the given iterator refer to the same underlying link.
Parameters
rhsthe iterator to compare with this.
Returns
true if and only if the two iterators are equal.

The documentation for this class was generated from the following file:

Copyright © 1999-2021, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@maths.uq.edu.au).