41 :
public boost::iterator_facade<ParticleIterator<BidirectionalIterator>,
42 detail::particle_t<BidirectionalIterator>,
43 boost::forward_traversal_tag> {
46 boost::iterator_facade<ParticleIterator<BidirectionalIterator>,
47 detail::particle_t<BidirectionalIterator>,
48 boost::forward_traversal_tag>;
49 using particle_iterator = detail::particle_iterator_t<BidirectionalIterator>;
51 BidirectionalIterator m_cell, m_end;
52 particle_iterator m_part;
56 : m_cell(cell), m_end(end) {
57 m_part = (m_cell != m_end) ? (*m_cell)->particles().begin()
58 : particle_iterator();
62 : m_cell(end), m_end(end), m_part() {}
65 friend typename base_type::difference_type
71 auto dist = std::distance(begin.m_part, (*begin.m_cell)->particles().end());
74 auto it = std::next(begin.m_cell);
76 while (it != end.m_cell) {
77 dist +=
static_cast<long>((*it)->particles().size());
87 assert(m_cell != m_end);
92 if (m_part == (*m_cell)->particles().end()) {
96 }
while ((m_cell != m_end) && ((*m_cell)->particles().empty()));
99 m_part = (m_cell != m_end) ? (*m_cell)->particles().begin()
100 : particle_iterator();
105 return (m_cell == (rhs.m_cell)) && (m_part == rhs.m_part);
108 auto &dereference()
const {
return *m_part; }
ParticleIterator(BidirectionalIterator end)
ParticleIterator(BidirectionalIterator cell, BidirectionalIterator end)
friend base_type::difference_type distance(ParticleIterator const &begin, ParticleIterator const &end)
friend class boost::iterator_core_access