MolSim
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
ParticleContainer::PairIterator Class Reference

Custom pair iterator for iterating through all possible pairs of Particle objects. More...

#include <ParticleContainer.h>

Public Member Functions

 PairIterator (ContainerType::iterator outer, ContainerType::iterator inner, ContainerType::iterator begin, ContainerType::iterator end)
 Construct a new Pair Iterator.
 
std::pair< Particle &, Particle & > operator* () const
 Override of the * operator, returning a pair of Particles.
 
PairIteratoroperator++ ()
 Override of the ++ operator.
 
bool operator== (const PairIterator &other) const
 Checks if two iterator instances point to the same Particle pair.
 
bool operator!= (const PairIterator &other) const
 Checks if two iterator instances do not point to the same Particle pair.
 

Private Attributes

ContainerType::iterator outer_it
 A standard library iterator for iterating through the outer pairs.
 
ContainerType::iterator inner_it
 A standard library iterator for iterating through the inner pairs.
 
ContainerType::iterator container_begin
 A standard library iterator marking the beginning of the iteration.
 
ContainerType::iterator container_end
 A standard library iterator marking the end of the iteration.
 

Detailed Description

Custom pair iterator for iterating through all possible pairs of Particle objects.

Constructor & Destructor Documentation

◆ PairIterator()

ParticleContainer::PairIterator::PairIterator ( ContainerType::iterator  outer,
ContainerType::iterator  inner,
ContainerType::iterator  begin,
ContainerType::iterator  end 
)

Construct a new Pair Iterator.

Parameters
outerA standard library iterator for iterating through the outer pairs.
innerA standard library iterator for iterating through the inner pairs.
beginA standard library iterator marking the beginning of the iteration.
endA standard library iterator marking the end of the iteration.

Member Function Documentation

◆ operator!=()

bool ParticleContainer::PairIterator::operator!= ( const PairIterator other) const

Checks if two iterator instances do not point to the same Particle pair.

Parameters
otherThe other pair iterator to compare iteration progress with.
Returns
true if at least one iterator points to a different object.
false if both iterators point to the same object.

◆ operator*()

std::pair< Particle &, Particle & > ParticleContainer::PairIterator::operator* ( ) const

Override of the * operator, returning a pair of Particles.

Returns
A pair of Particle references.

◆ operator++()

PairIterator & ParticleContainer::PairIterator::operator++ ( )

Override of the ++ operator.

Begins by incrementing the inner iterator. Once the inner iterator has reached the final Particle in the container, the outer iterator gets incremented and the inner iterator is reset to the beginning.

Returns
A PairIterator& used to continue iteration.

◆ operator==()

bool ParticleContainer::PairIterator::operator== ( const PairIterator other) const

Checks if two iterator instances point to the same Particle pair.

Parameters
otherThe other pair iterator to compare iteration progress with.
Returns
true if both iterators point to the same object.
false if at least one iterator points to a different object.

Member Data Documentation

◆ container_begin

ContainerType::iterator ParticleContainer::PairIterator::container_begin
private

A standard library iterator marking the beginning of the iteration.

◆ container_end

ContainerType::iterator ParticleContainer::PairIterator::container_end
private

A standard library iterator marking the end of the iteration.

◆ inner_it

ContainerType::iterator ParticleContainer::PairIterator::inner_it
private

A standard library iterator for iterating through the inner pairs.

◆ outer_it

ContainerType::iterator ParticleContainer::PairIterator::outer_it
private

A standard library iterator for iterating through the outer pairs.


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