World_iterator.hpp
This file defines iterators for use with World objects.
- Todo:
Add a const interator.
Currently we do MakeValid after every change AND before many accesses. Pick one?
Fix operator– which can go off of the beginnig of the world.
Note
Originally called PopulationIterator.h
-
template<typename WORLD>
class World_iterator - #include <World_iterator.hpp>
Public Functions
-
inline World_iterator(Ptr<world_t> _w, size_t _p = 0)
Create an iterator in the specified world pointing to the first occupied cell after the provided start position.
-
inline World_iterator(const World_iterator &_in)
Create an iterator pointing to the same position as another iterator.
-
inline this_t &operator=(const World_iterator &_in)
Assign this iterator to the position of another iterator.
-
inline bool operator==(const this_t &rhs) const
Compare two iterators to determine if they point to identical positions in the world.
-
inline bool operator!=(const this_t &rhs) const
Compare two iterators to determine if they point to different positions in the world.
-
inline bool operator<(const this_t &rhs) const
Determine if this iterator points to a position in the world BEFORE another iterator.
-
inline bool operator<=(const this_t &rhs) const
Determine if this iterator points to a position in the world BEFORE or the SAME AS another iterator.
-
inline bool operator>(const this_t &rhs) const
Determine if this iterator points to a position in the world AFTER another iterator.
-
inline bool operator>=(const this_t &rhs) const
Determine if this iterator points to a position in the world AFTER or the SAME AS another iterator.
-
inline const org_t &operator*() const
Return a const reference to the organism pointed to by this iterator.
-
inline operator bool() const
Is this iterator pointing to a valid cell in the world?
Private Types
-
using this_t = World_iterator<world_t>
-
inline World_iterator(Ptr<world_t> _w, size_t _p = 0)