20 #ifndef TULIP_STABLEITERATOR_H
21 #define TULIP_STABLEITERATOR_H
27 #include <tulip/Iterator.h>
28 #include <tulip/StlIterator.h>
29 #include <tulip/tulipconf.h>
73 bool sortCopy =
false) {
76 for (; inputIterator->
hasNext();) {
151 template <
typename Container>
152 typename std::enable_if<has_const_iterator<Container>::value,
153 StableIterator<typename Container::value_type>
StableIterator< T > * stableIterator(Iterator< T > *it)
Convenient function for creating a StableIterator.
std::enable_if< has_const_iterator< Container >::value, StlIterator< typename Container::value_type, typename Container::const_iterator > * >::type stlIterator(const Container &stlContainer)
Convenient function for creating a StlIterator from a stl container.
Interface for Tulip iterators. Allows basic iteration operations only.
virtual bool hasNext()=0
Tells if the sequence is at its end.
virtual T next()=0
Moves the Iterator on the next element.
Stores the elements of an iterator and iterates a copy.
StableIterator(Iterator< T > *inputIterator, size_t nbElements=0, bool deleteIterator=true, bool sortCopy=false)
Creates a stable Iterator, that allows to delete elements from a graph while iterating on them.
void restart()
Restarts the iteration by moving the Iterator to the beginning of the sequence.
std::vector< T >::const_iterator copyIterator
STL const_iterator on the cloned sequence.
T next()
Moves the Iterator on the next element.
std::vector< T > sequenceCopy
A copy of the sequence of the elements to iterate.
bool hasNext()
Tells if the sequence is at its end.