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


A forward iterator for iterating through all immediate children of a given packet. More...

#include <packet/packet.h>

Public Member Functions

 ChildIterator ()
 
Creates a past-the-end iterator. More...
 
 ChildIterator (const ChildIterator &)=default
 
Default copy constructor. More...
 
 ChildIterator (Packet *current)
 
Creates a new iterator pointing to the given child packet. More...
 
ChildIteratoroperator= (const ChildIterator &)=default
 Default copy assignment operator. More...
 
bool operator== (const ChildIterator &rhs) const
 Tests whether this and the given iterator are equal. More...
 
bool operator!= (const ChildIterator &rhs) const
 Tests whether this and the given iterator are different. More...
 
ChildIteratoroperator++ ()
 
Preincrement operator. More...
 
ChildIterator operator++ (int)
 
Postincrement operator. More...
 
Packet *const & operator* () const
 
Returns the packet that this iterator is currently pointing to. More...
 

Detailed Description


A forward iterator for iterating through all immediate children of a given packet.

This header also specialises std::iterator_traits for this iterator class.

Python
Instead of the C++ interface described here, in Python the classes PacketChildren and ChildIterator together implement the Python iterable/iterator interface. The class PacketChildren has just the single function __iter__(), which returns a ChildIterator; then ChildIterator implements next(), which either returns the next child packet in the iteration or else throws a StopException if there are no more children to return.

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).