Regina 7.3 Calculation Engine
Public Types | Public Member Functions | Friends | List of all members
regina::PermGroup< n, cached >::iterator Class Reference

The iterator type for this group. More...

#include <maths/permgroup.h>

Public Types

using value_type = Perm< n >
 Indicates what type the iterator points to. More...
 
using iterator_category = std::input_iterator_tag
 Declares this to be an input iterator type. More...
 
using difference_type = typename Perm< n >::Index
 The type obtained by subtracting iterators. More...
 
using pointer = const value_type *
 A pointer to value_type. More...
 
using reference = Perm< n >
 The type returned by the dereference operator, which for this iterator type is by value. More...
 

Public Member Functions

 iterator ()
 Creates a new uninitialised iterator. More...
 
 iterator (const iterator &)=default
 Creates a copy of the given iterator. More...
 
iteratoroperator= (const iterator &)=default
 Makes this a copy of the given iterator. More...
 
bool operator== (const iterator &rhs) const
 Compares this with the given iterator for equality. More...
 
bool operator!= (const iterator &rhs) const
 Compares this with the given iterator for inequality. More...
 
iteratoroperator++ ()
 The preincrement operator. More...
 
iterator operator++ (int)
 The postincrement operator. More...
 
Perm< n > __next__ ()
 Returns the current permutation and increments this iterator. More...
 
Perm< n > operator* () const
 Returns the permutation that this iterator is currently pointing to. More...
 
 operator bool () const
 Identifies whether this iterator is dereferenceable. More...
 

Friends

class PermGroup< n, cached >
 

Detailed Description

template<int n, bool cached = false>
class regina::PermGroup< n, cached >::iterator

The iterator type for this group.

Unlike most iterator types, the dereference operator for this iterator type returns by value (not by reference). This is because the individual permutations in a group are generated (not stored), based upon an internal group representation that is typically much smaller than the group itself.

Both iterator and const_iterator are the same type, since a PermGroup only offers read-only access to its group members.

Member Typedef Documentation

◆ difference_type

template<int n, bool cached = false>
using regina::PermGroup< n, cached >::iterator::difference_type = typename Perm<n>::Index

The type obtained by subtracting iterators.

◆ iterator_category

template<int n, bool cached = false>
using regina::PermGroup< n, cached >::iterator::iterator_category = std::input_iterator_tag

Declares this to be an input iterator type.

◆ pointer

template<int n, bool cached = false>
using regina::PermGroup< n, cached >::iterator::pointer = const value_type*

A pointer to value_type.

◆ reference

template<int n, bool cached = false>
using regina::PermGroup< n, cached >::iterator::reference = Perm<n>

The type returned by the dereference operator, which for this iterator type is by value.

See the iterator class notes for details.

◆ value_type

template<int n, bool cached = false>
using regina::PermGroup< n, cached >::iterator::value_type = Perm<n>

Indicates what type the iterator points to.

Constructor & Destructor Documentation

◆ iterator() [1/2]

template<int n, bool cached>
regina::PermGroup< n, cached >::iterator::iterator
inline

Creates a new uninitialised iterator.

Python
Not present. The only way to create an iterator over a PermGroup g is to iterate over g (i.e., to call g.__iter__()).

◆ iterator() [2/2]

template<int n, bool cached = false>
regina::PermGroup< n, cached >::iterator::iterator ( const iterator )
default

Creates a copy of the given iterator.

Python
Not present. The only way to create an iterator over a PermGroup g is to iterate over g (i.e., to call g.__iter__()).

Member Function Documentation

◆ __next__()

template<int n, bool cached = false>
Perm< n > regina::PermGroup< n, cached >::iterator::__next__ ( )

Returns the current permutation and increments this iterator.

C++
Not present. For C++ users, ChildIterator provides the usual iterator preincrement, postincrement and dereferencing operators (++ and *) instead.
Exceptions
StopIterationThe iterator is already past-the-end when this function is called.
Returns
the permutation that this iterator is pointing to, before the increment takes place.

◆ operator bool()

template<int n, bool cached>
regina::PermGroup< n, cached >::iterator::operator bool
inline

Identifies whether this iterator is dereferenceable.

Python
Not present. For Python users, this class implements the Python iterator interface instead. See next() for details.
Returns
true if and only if this is dereferenceable (i.e., not past-the-end).

◆ operator!=()

template<int n, bool cached = false>
bool regina::PermGroup< n, cached >::iterator::operator!= ( const iterator rhs) const
inline

Compares this with the given iterator for inequality.

To be considered equal, two iterators must be pointing to the same permutation within the same group. (The second condition means that the underlying PermGroup pointers must be the same - it is not enough to have two distinct PermGorup objects with identical contents.)

Two past-the-end iterators will always be considered equal.

Parameters
rhsthe iterator to compare this with.
Returns
false if the iterators point to the same permutation, or true if they do not.

◆ operator*()

template<int n, bool cached>
Perm< n > regina::PermGroup< n, cached >::iterator::operator*
inline

Returns the permutation that this iterator is currently pointing to.

Precondition
This iterator is dereferenceable (in particular, it is not past-the-end).
Python
Not present. For Python users, this class implements the Python iterator interface instead. See next() for details.
Returns
the corresponding permutation.

◆ operator++() [1/2]

template<int n, bool cached = false>
iterator & regina::PermGroup< n, cached >::iterator::operator++ ( )

The preincrement operator.

Python
Not present. For Python users, this class implements the Python iterator interface instead. See next() for details.
Returns
a reference to this iterator after the increment.

◆ operator++() [2/2]

template<int n, bool cached>
PermGroup< n, cached >::iterator regina::PermGroup< n, cached >::iterator::operator++ ( int  )
inline

The postincrement operator.

Python
Not present. For Python users, this class implements the Python iterator interface instead. See next() for details.
Returns
a copy of this iterator before the increment took place.

◆ operator=()

template<int n, bool cached = false>
iterator & regina::PermGroup< n, cached >::iterator::operator= ( const iterator )
default

Makes this a copy of the given iterator.

Returns
a reference to this iterator.

◆ operator==()

template<int n, bool cached = false>
bool regina::PermGroup< n, cached >::iterator::operator== ( const iterator rhs) const
inline

Compares this with the given iterator for equality.

To be considered equal, two iterators must be pointing to the same permutation within the same group. (The second condition means that the underlying PermGroup pointers must be the same - it is not enough to have two distinct PermGorup objects with identical contents.)

Two past-the-end iterators will always be considered equal.

Parameters
rhsthe iterator to compare this with.
Returns
true if the iterators point to the same permutation, or false if they do not.

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

Copyright © 1999-2023, 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).