Regina 7.3.1 Calculation Engine
|
A forward iterator for iterating through all immediate children of a given packet. More...
#include <packet/packet.h>
Public Types | |
using | packet_type = std::conditional_t<const_, const Packet, Packet> |
Indicates what the iterator points to. | |
Public Member Functions | |
ChildIterator ()=default | |
Creates a past-the-end iterator. | |
ChildIterator (const ChildIterator &)=default | |
Creates a new copy of the given iterator. | |
ChildIterator (std::shared_ptr< packet_type > current) | |
Creates a new iterator pointing to the given child packet. | |
ChildIterator & | operator= (const ChildIterator &)=default |
Sets this to be a copy of the given iterator. | |
bool | operator== (const ChildIterator &rhs) const |
Tests whether this and the given iterator are equal. | |
bool | operator!= (const ChildIterator &rhs) const |
Tests whether this and the given iterator are different. | |
ChildIterator & | operator++ () |
Preincrement operator. | |
ChildIterator | operator++ (int) |
Postincrement operator. | |
auto | __next__ () |
Returns the current child packet and increments this iterator. | |
packet_type & | operator* () const |
Returns the packet that this iterator is currently pointing to. | |
operator bool () const | |
Identifies whether this iterator is dereferencable. | |
A forward iterator for iterating through all immediate children of a given packet.
Each iterator will hold a std::shared_ptr to the packet whose children it is iterating over. This guarantees that the packet will not be destroyed mid-iteration, but it also means that you must ensure that you dispose of your iterators once you are finished with them.
As of Regina 7.3.1, this class no longer provides the iterator type aliases value_type, iterator_category, difference_type, pointer and reference. Instead you can access these through std::iterator_traits
.
const_ | Indicates whether this iterator should offer const or non-const access to the child packets. |
__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. All iteration in Python is non-const (i.e., Python exclusively uses the classes where const_ is false
). using regina::ChildIterator< const_ >::packet_type = std::conditional_t<const_, const Packet, Packet> |
|
default |
Creates a past-the-end iterator.
|
default |
Creates a new copy of the given iterator.
|
inline |
Creates a new iterator pointing to the given child packet.
current | the child packet that the new iterator should point to, or null if the new iterator should be past-the-end. |
auto regina::ChildIterator< const_ >::__next__ | ( | ) |
Returns the current child packet and increments this iterator.
StopIteration | The iterator is already past-the-end when this function is called. |
|
inline |
Identifies whether this iterator is dereferencable.
true
if and only if this is dereferencable (i.e., not past-the-end).
|
inline |
Tests whether this and the given iterator are different.
|
inline |
Returns the packet that this iterator is currently pointing to.
|
inline |
Preincrement operator.
|
inline |
Postincrement operator.
|
default |
Sets this to be a copy of the given iterator.
|
inline |
Tests whether this and the given iterator are equal.