AutoPas  3.0.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
CellIterator< StorageType, modifiable > Class Template Reference

Wraps the iterator of arbitrary cells to provide a common interface. More...

#include <CellIterator.h>

Public Types

using IteratorType = std::conditional_t< modifiable, typename StorageType::iterator, typename StorageType::const_iterator >
 Type of the wrapped iterator.
 
using ParticleType = std::remove_pointer_t< typename StorageType::value_type >
 Type of the Particles in the storage.
 
using difference_type = typename IteratorType::difference_type
 Type trait to be compatible with std::iterator.
 
using value_type = typename IteratorType::value_type
 Type trait to be compatible with std::iterator.
 
using pointer = typename IteratorType::pointer
 Type trait to be compatible with std::iterator.
 
using reference = typename IteratorType::reference
 Type trait to be compatible with std::iterator.
 
using iterator_category = typename IteratorType::iterator_category
 Type trait to be compatible with std::iterator.
 

Public Member Functions

 CellIterator (IteratorType iterator)
 Constructor.
 
std::conditional_t< modifiable, ParticleType &, const ParticleType & > operator* () const
 Dereference operator.
 
std::conditional_t< modifiable, ParticleType *, const ParticleType * > operator-> () const
 Dereference operator.
 
CellIterator< StorageType, modifiable > & operator++ ()
 Increment the iterator.
 
CellIterator< StorageType, modifiable > & operator-- ()
 Decrement the iterator.
 
bool operator== (const CellIterator &rhs) const
 Equality operator.
 
bool operator!= (const CellIterator &rhs) const
 Not equality operator.
 
difference_type operator- (const CellIterator &rhs) const
 Distance between two iterators.
 
bool operator< (const CellIterator &rhs) const
 Comparison operator.
 

Detailed Description

template<class StorageType, bool modifiable>
class CellIterator< StorageType, modifiable >

Wraps the iterator of arbitrary cells to provide a common interface.

Note
This class is necessary because some cells store Particle_T and others Particle_T *.
Template Parameters
StorageTypeType of the cell, used to derive the particle type.
modifiableIf false, this is a const iterator, meaning, the underlying particle can not be modified.

Member Typedef Documentation

◆ ParticleType

template<class StorageType , bool modifiable>
using CellIterator< StorageType, modifiable >::ParticleType = std::remove_pointer_t<typename StorageType::value_type>

Type of the Particles in the storage.

Should always be the actual type and not a pointer.

Constructor & Destructor Documentation

◆ CellIterator()

template<class StorageType , bool modifiable>
CellIterator< StorageType, modifiable >::CellIterator ( IteratorType  iterator)
inlineexplicit

Constructor.

Parameters
iterator

Member Function Documentation

◆ operator!=()

template<class StorageType , bool modifiable>
bool CellIterator< StorageType, modifiable >::operator!= ( const CellIterator< StorageType, modifiable > &  rhs) const
inline

Not equality operator.

Parameters
rhs
Returns

◆ operator*()

template<class StorageType , bool modifiable>
std::conditional_t< modifiable, ParticleType &, const ParticleType & > CellIterator< StorageType, modifiable >::operator* ( ) const
inline

Dereference operator.

Returns
Reference to the current particle.

◆ operator++()

template<class StorageType , bool modifiable>
CellIterator< StorageType, modifiable > & CellIterator< StorageType, modifiable >::operator++ ( )
inline

Increment the iterator.

Returns
*this

◆ operator-()

template<class StorageType , bool modifiable>
difference_type CellIterator< StorageType, modifiable >::operator- ( const CellIterator< StorageType, modifiable > &  rhs) const
inline

Distance between two iterators.

Parameters
rhs
Returns
Number of elements between two iterators.

◆ operator--()

template<class StorageType , bool modifiable>
CellIterator< StorageType, modifiable > & CellIterator< StorageType, modifiable >::operator-- ( )
inline

Decrement the iterator.

Returns
*this

◆ operator->()

template<class StorageType , bool modifiable>
std::conditional_t< modifiable, ParticleType *, const ParticleType * > CellIterator< StorageType, modifiable >::operator-> ( ) const
inline

Dereference operator.

Returns
Pointer to the current particle.

◆ operator<()

template<class StorageType , bool modifiable>
bool CellIterator< StorageType, modifiable >::operator< ( const CellIterator< StorageType, modifiable > &  rhs) const
inline

Comparison operator.

Parameters
rhs
Returns
True if this is before (in – direction) rhs.

◆ operator==()

template<class StorageType , bool modifiable>
bool CellIterator< StorageType, modifiable >::operator== ( const CellIterator< StorageType, modifiable > &  rhs) const
inline

Equality operator.

Parameters
rhs
Returns

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