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

Iterates through the two crossings adjacent to a given crossing of a knot or link via an outgoing arc. More...

#include <link/graph.h>

Public Member Functions

 AdjacentCrossingIterator ()
 Creates a singular iterator. More...
 
 AdjacentCrossingIterator (Crossing *crossing, int strand=0)
 Creates a new iterator that runs through the two crossings adjacent to the given crossing via an outgoing arc. More...
 
 AdjacentCrossingIterator (const AdjacentCrossingIterator &)=default
 Default copy constructor. More...
 
AdjacentCrossingIteratoroperator++ ()
 Preincrement operator. More...
 
AdjacentCrossingIterator operator++ (int)
 Postincrement operator. More...
 
Crossingoperator* () const
 Returns the adjacent crossing to which this iterator points. More...
 
AdjacentCrossingIteratoroperator= (const AdjacentCrossingIterator &)=default
 Default assignment operator. More...
 
bool operator== (const AdjacentCrossingIterator &rhs) const
 Tests whether this and the given iterator are equal. More...
 
bool operator!= (const AdjacentCrossingIterator &rhs) const
 Tests whether this and the given iterator are different. More...
 

Detailed Description

Iterates through the two crossings adjacent to a given crossing of a knot or link via an outgoing arc.

The order of iteration is as follows: first this will visit the crossing adjacent via the arc leaving the lower strand of the given crossing; then it will visit the crossing adjacent via the arc leaving the upper strand of the given crossing.

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.

Constructor & Destructor Documentation

◆ AdjacentCrossingIterator() [1/3]

regina::graph::AdjacentCrossingIterator::AdjacentCrossingIterator ( )
inline

Creates a singular iterator.

◆ AdjacentCrossingIterator() [2/3]

regina::graph::AdjacentCrossingIterator::AdjacentCrossingIterator ( Crossing crossing,
int  strand = 0 
)
inline

Creates a new iterator that runs through the two crossings adjacent to the given crossing via an outgoing arc.

Parameters
crossingthe crossing whose adjacent crossings we are iterating through.
strand0 if we should begin at the crossing adjacent via the lower strand; 1 if we should begin at the crossing adjacent via the upper strand; or 2 if the iterator should be marked as past-the-end.

◆ AdjacentCrossingIterator() [3/3]

regina::graph::AdjacentCrossingIterator::AdjacentCrossingIterator ( const AdjacentCrossingIterator )
default

Default copy constructor.

Member Function Documentation

◆ operator!=()

bool regina::graph::AdjacentCrossingIterator::operator!= ( const AdjacentCrossingIterator rhs) const
inline

Tests whether this and the given iterator are different.

Note
This only tests the "current strand" for each iterator, which identifies the adjacent crossings that they are pointing to. It does not compare the original "source" crossings that were passed to each constructor.
Parameters
rhsthe iterator to compare with this.
Returns
true if and only if the two iterators are different.

◆ operator*()

Crossing * regina::graph::AdjacentCrossingIterator::operator* ( ) const
inline

Returns the adjacent crossing to which this iterator points.

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

◆ operator++() [1/2]

AdjacentCrossingIterator & regina::graph::AdjacentCrossingIterator::operator++ ( )
inline

Preincrement operator.

Returns
a reference to this iterator.

◆ operator++() [2/2]

AdjacentCrossingIterator regina::graph::AdjacentCrossingIterator::operator++ ( int  )
inline

Postincrement operator.

Returns
a copy of this iterator before it was incremented.

◆ operator=()

AdjacentCrossingIterator& regina::graph::AdjacentCrossingIterator::operator= ( const AdjacentCrossingIterator )
default

Default assignment operator.

Returns
a reference to this iterator.

◆ operator==()

bool regina::graph::AdjacentCrossingIterator::operator== ( const AdjacentCrossingIterator rhs) const
inline

Tests whether this and the given iterator are equal.

Note
This only tests the "current strand" for each iterator, which identifies the adjacent crossings that they are pointing to. It does not compare the original "source" crossings that were passed to each constructor.
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).