43 #ifndef HETEROGENEOUSLIST_HPP
44 #define HETEROGENEOUSLIST_HPP
49 template <
class Node>
class HeterogeneousList;
64 : m_prev(this), m_next(this)
74 : m_prev(list->m_peg->m_prev), m_next(m_prev->m_next)
76 m_prev->m_next =
this;
77 m_next->m_prev =
this;
87 m_prev->m_next = m_next;
88 m_next->m_prev = m_prev;
102 m_prev->m_next = m_next;
103 m_next->m_prev = m_prev;
137 return m_peg->m_next == m_peg;
175 static void link(Link* fore, Link* aft)
182 static void splice_link(Link* pos, Link* mover)
184 link(mover->m_prev, mover->m_next);
185 link(pos->m_prev, mover);
192 static void splice_links(Link* pos, Link* from, Link* to);
199 splice_links(m_peg, other->m_peg->m_next, other->m_peg);
209 template <
class Node>
215 :
public std::iterator<std::bidirectional_iterator_tag,
219 const Node* operator*()
const
221 return static_cast<const Node*
>(m_link);
226 return m_link != other.m_link;
261 return static_cast<const Node*
>(
predecessor(m_peg));
264 const_iterator begin()
const
269 const_iterator end()
const
271 return const_iterator(m_peg);
281 return static_cast<Node*
>(
successor(m_peg));
291 return static_cast<const Node*
>(
successor(m_peg));
302 splice_link(m_peg, asLink(node));
323 Link* asLink(
const Node* node)
325 return const_cast<Node*
>(node);
330 #endif // HETEROGENEOUSLIST_HPP