Tulip  5.3.0
Large graphs analysis and drawing
tlp::Iterator< T > Struct Template Referenceabstract

#include <Iterator.h>

+ Inheritance diagram for tlp::Iterator< T >:

Public Member Functions

iterator_t begin ()
 
iterator_t end ()
 
virtual bool hasNext ()=0
 
virtual T next ()=0
 

Detailed Description

template<typename T>
struct tlp::Iterator< T >

Interface for Tulip iterators. Allows basic iteration operations only.

Below are some examples about how to use Tulip iterators in C++ code.

// graph is a pointer to a tlp::Graph instance
// shortest syntax using C++11 for range based loops
for (auto n : graph->getNodes()) {
// do someting with n
}
// legacy syntax using Tulip forEach macro
#include <tulip/ForEach.h>
forEach(n, graph->getNodes()) {
// do something with n
}
// no syntactic sugar syntax (needs to explicitely delete the iterator
// after its use)
tlp::Iterator<tl::node> *nodesIt = graph->getNodes();
while (nodesIt->hasNext()) {
tlp::node n = nodes->next();
// do something with n
}
delete nodesIt;

Definition at line 41 of file Graph.h.

Member Function Documentation

◆ hasNext()

template<typename T>
virtual bool tlp::Iterator< T >::hasNext ( )
pure virtual

◆ next()