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 for std::iterator_traits, to enable use of standard library algorithms.
 
using value_type = typename IteratorType::value_type
 Type trait for std::iterator_traits, to enable use of standard library algorithms.
 
using pointer = typename IteratorType::pointer
 Type trait for std::iterator_traits, to enable use of standard library algorithms.
 
using reference = typename IteratorType::reference
 Type trait for std::iterator_traits, to enable use of standard library algorithms.
 
using iterator_category = typename IteratorType::iterator_category
 Type trait for std::iterator_traits, to enable use of standard library algorithms.
 

Public Member Functions

 CellIterator ()=default
 Default constructor, required for std::bidirectional_iterator.
 
 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++ ()
 Prefix increment.
 
CellIterator< StorageType, modifiable > operator++ (int)
 Postfix increment.
 
CellIterator< StorageType, modifiable > & operator-- ()
 Prefix decrement.
 
CellIterator< StorageType, modifiable > operator-- (int)
 Postfix decrement.
 
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

◆ difference_type

template<class StorageType , bool modifiable>
using CellIterator< StorageType, modifiable >::difference_type = typename IteratorType::difference_type

Type trait for std::iterator_traits, to enable use of standard library algorithms.

Must be of the name expected by the standard library, hence not camel case like the rest of the project.

◆ iterator_category

template<class StorageType , bool modifiable>
using CellIterator< StorageType, modifiable >::iterator_category = typename IteratorType::iterator_category

Type trait for std::iterator_traits, to enable use of standard library algorithms.

Must be of the name expected by the standard library, hence not camel case like the rest of the project.

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

◆ value_type

template<class StorageType , bool modifiable>
using CellIterator< StorageType, modifiable >::value_type = typename IteratorType::value_type

Type trait for std::iterator_traits, to enable use of standard library algorithms.

Must be of the name expected by the standard library, hence not camel case like the rest of the project.

Constructor & Destructor Documentation

◆ CellIterator() [1/2]

template<class StorageType , bool modifiable>
CellIterator< StorageType, modifiable >::CellIterator ( )
default

Default constructor, required for std::bidirectional_iterator.

The result does not point to any particle.

◆ CellIterator() [2/2]

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++() [1/2]

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

Prefix increment.

Returns
*this

◆ operator++() [2/2]

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

Postfix increment.

Returns
Copy of the iterator from before the increment.

◆ 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--() [1/2]

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

Prefix decrement.

Returns
*this

◆ operator--() [2/2]

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

Postfix decrement.

Returns
Copy of the iterator from before the decrement.

◆ 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: