Doxygen
Loading...
Searching...
No Matches
DualDirIterator< C, I > Class Template Reference

helper class representing an iterator that can iterate forwards or backwards More...

Public Member Functions

 DualDirIterator (C &container, bool fwd)
void operator++ ()
I & operator* ()
bool atEnd ()

Private Attributes

C & m_container
bool m_forward
C::iterator m_it
C::reverse_iterator m_rit

Detailed Description

template<class C, class I>
class DualDirIterator< C, I >

helper class representing an iterator that can iterate forwards or backwards

Definition at line 552 of file diagram.cpp.

Constructor & Destructor Documentation

◆ DualDirIterator()

template<class C, class I>
DualDirIterator< C, I >::DualDirIterator ( C & container,
bool fwd )
inline

Definition at line 555 of file diagram.cpp.

557 {
558 if (fwd) m_it = container.begin();
559 else m_rit = container.rbegin();
560 }
helper class representing an iterator that can iterate forwards or backwards
Definition diagram.cpp:553
C::reverse_iterator m_rit
Definition diagram.cpp:582
C::iterator m_it
Definition diagram.cpp:581

References m_container, m_forward, m_it, and m_rit.

Member Function Documentation

◆ atEnd()

template<class C, class I>
bool DualDirIterator< C, I >::atEnd ( )
inline

Definition at line 570 of file diagram.cpp.

571 {
572 if (m_forward)
573 return m_it==m_container.end();
574 else
575 return m_rit==m_container.rend();
576 }

References m_container, m_forward, m_it, and m_rit.

Referenced by TreeDiagram::drawBoxes().

◆ operator*()

template<class C, class I>
I & DualDirIterator< C, I >::operator* ( )
inline

Definition at line 565 of file diagram.cpp.

566 {
567 return m_forward ? *m_it : *m_rit;
568 }

References m_forward, m_it, and m_rit.

◆ operator++()

template<class C, class I>
void DualDirIterator< C, I >::operator++ ( )
inline

Definition at line 561 of file diagram.cpp.

562 {
563 if (m_forward) ++m_it++; else ++m_rit;
564 }

References m_forward, m_it, and m_rit.

Member Data Documentation

◆ m_container

template<class C, class I>
C& DualDirIterator< C, I >::m_container
private

Definition at line 579 of file diagram.cpp.

Referenced by atEnd(), and DualDirIterator().

◆ m_forward

template<class C, class I>
bool DualDirIterator< C, I >::m_forward
private

Definition at line 580 of file diagram.cpp.

Referenced by atEnd(), DualDirIterator(), operator*(), and operator++().

◆ m_it

template<class C, class I>
C::iterator DualDirIterator< C, I >::m_it
private

Definition at line 581 of file diagram.cpp.

Referenced by atEnd(), DualDirIterator(), operator*(), and operator++().

◆ m_rit

template<class C, class I>
C::reverse_iterator DualDirIterator< C, I >::m_rit
private

Definition at line 582 of file diagram.cpp.

Referenced by atEnd(), DualDirIterator(), operator*(), and operator++().


The documentation for this class was generated from the following file: