#include <particles.h>
Iterator type that skips over the holes in data_
. It implements a standard bidirectional iterator over the ParticleData objects in Particles. Each iterator must expose 5 types to correctly interact with the STL:
iterator_category
value_type
difference_type
pointer
reference
Prior to C++17 it was common habit to inherit from std::iterator
to simplify the implementation of user-defined iterators, but this turned out not to be the most readable choice and this habit has been deprecated in C++17. It is simply better to explicitly expose the 5 types.
Definition at line 245 of file particles.h.
Public Types | |
using | iterator_category = std::bidirectional_iterator_tag |
Required by STL: expose iterator_category More... | |
using | value_type = std::remove_const_t< T > |
Required by STL: expose value_type removing const qualification More... | |
using | difference_type = std::ptrdiff_t |
Required by STL: expose difference_type More... | |
using | pointer = std::add_pointer_t< T > |
Required by STL: expose pointer (of a reference) More... | |
using | reference = std::add_lvalue_reference_t< T > |
Required by STL: expose reference (lvalue) More... | |
using | const_pointer = std::add_const_t< pointer > |
add const qualification to a pointer More... | |
using | const_reference = std::add_const_t< reference > |
add const qualification to a reference More... | |
Public Member Functions | |
GenericIterator & | operator++ () |
Advance the iterator to the next valid (not a hole) entry in Particles. More... | |
GenericIterator | operator++ (int) |
Postfix variant of the above prefix increment operator. More... | |
GenericIterator & | operator-- () |
Advance the iterator to the previous valid (not a hole) entry in Particles. More... | |
GenericIterator | operator-- (int) |
Postfix variant of the above prefix decrement operator. More... | |
reference | operator* () |
const_reference | operator* () const |
pointer | operator-> () |
const_pointer | operator-> () const |
bool | operator== (const GenericIterator &rhs) const |
bool | operator!= (const GenericIterator &rhs) const |
bool | operator< (const GenericIterator &rhs) const |
bool | operator> (const GenericIterator &rhs) const |
bool | operator<= (const GenericIterator &rhs) const |
bool | operator>= (const GenericIterator &rhs) const |
Private Member Functions | |
GenericIterator (pointer p) | |
Constructs an iterator pointing to the ParticleData pointed to by p . More... | |
Private Attributes | |
pointer | ptr_ |
The entry in Particles this iterator points to. More... | |
Friends | |
class | Particles |
using smash::Particles::GenericIterator< T >::iterator_category = std::bidirectional_iterator_tag |
Required by STL: expose iterator_category
Definition at line 250 of file particles.h.
using smash::Particles::GenericIterator< T >::value_type = std::remove_const_t<T> |
Required by STL: expose value_type removing const qualification
Definition at line 252 of file particles.h.
using smash::Particles::GenericIterator< T >::difference_type = std::ptrdiff_t |
Required by STL: expose difference_type
Definition at line 254 of file particles.h.
using smash::Particles::GenericIterator< T >::pointer = std::add_pointer_t<T> |
Required by STL: expose pointer (of a reference)
Definition at line 256 of file particles.h.
using smash::Particles::GenericIterator< T >::reference = std::add_lvalue_reference_t<T> |
Required by STL: expose reference (lvalue)
Definition at line 258 of file particles.h.
using smash::Particles::GenericIterator< T >::const_pointer = std::add_const_t<pointer> |
add const qualification to a pointer
Definition at line 260 of file particles.h.
using smash::Particles::GenericIterator< T >::const_reference = std::add_const_t<reference> |
add const qualification to a reference
Definition at line 262 of file particles.h.
|
inlineprivate |
Constructs an iterator pointing to the ParticleData pointed to by p
.
This constructor may only be called from the Particles class.
[in] | p | The particle which is pointed by the iterator. |
Definition at line 271 of file particles.h.
|
inline |
Advance the iterator to the next valid (not a hole) entry in Particles.
Holes are identified by the ParticleData::hole_ member and thus the internal pointer is incremented until all holes are skipped. It is important that the Particles entry pointed to by Particles::end() is not identified as a hole as otherwise the iterator would advance too far.
Definition at line 286 of file particles.h.
|
inline |
Postfix variant of the above prefix increment operator.
Definition at line 297 of file particles.h.
|
inline |
Advance the iterator to the previous valid (not a hole) entry in Particles.
Holes are identified by the ParticleData::hole_ member and thus the internal pointer is decremented until all holes are skipped. It is irrelevant whether Particles::data_[0] is a hole because the iteration typically ends at Particles::begin(), which points to a non-hole entry in Particles::data_.
Definition at line 314 of file particles.h.
|
inline |
Postfix variant of the above prefix decrement operator.
Definition at line 325 of file particles.h.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 342 of file particles.h.
|
inline |
Definition at line 346 of file particles.h.
|
inline |
rhs
. Definition at line 350 of file particles.h.
|
inline |
rhs
. Definition at line 352 of file particles.h.
|
inline |
rhs
or points to the same object. Definition at line 357 of file particles.h.
|
inline |
rhs
or points to the same object. Definition at line 364 of file particles.h.
|
friend |
Definition at line 246 of file particles.h.
|
private |
The entry in Particles this iterator points to.
Definition at line 274 of file particles.h.