Pangolin
Header-only C++20 plane computational geometry library
Loading...
Searching...
No Matches
pgl::Graph< Vertex >::Iterator Class Reference

Forward iterator over the vertices of a graph. More...

#include <graph.hpp>

Public Types

using iterator_category = std::forward_iterator_tag
using iterator_concept = std::forward_iterator_tag
using difference_type = std::ptrdiff_t
using value_type = Vertex
using pointer = const Vertex*
using reference = const Vertex&

Public Member Functions

 Iterator ()=default
 Creates an iterator with no associated graph.
reference operator* () const
 Returns the current vertex.
pointer operator-> () const
 Returns a pointer to the current vertex.
Iteratoroperator++ ()
 Advances to the next vertex.
Iterator operator++ (int)
 Advances to the next vertex and returns the previous position.

Friends

class Graph
bool operator== (const Iterator &, const Iterator &)=default

Detailed Description

template<class Vertex>
class pgl::Graph< Vertex >::Iterator

Forward iterator over the vertices of a graph.

Dereferencing the iterator yields a const reference because changing a vertex in place would invalidate the graph's hash table.

Member Typedef Documentation

◆ difference_type

template<class Vertex>
using pgl::Graph< Vertex >::Iterator::difference_type = std::ptrdiff_t

◆ iterator_category

template<class Vertex>
using pgl::Graph< Vertex >::Iterator::iterator_category = std::forward_iterator_tag

◆ iterator_concept

template<class Vertex>
using pgl::Graph< Vertex >::Iterator::iterator_concept = std::forward_iterator_tag

◆ pointer

template<class Vertex>
using pgl::Graph< Vertex >::Iterator::pointer = const Vertex*

◆ reference

template<class Vertex>
using pgl::Graph< Vertex >::Iterator::reference = const Vertex&

◆ value_type

template<class Vertex>
using pgl::Graph< Vertex >::Iterator::value_type = Vertex

Constructor & Destructor Documentation

◆ Iterator()

template<class Vertex>
pgl::Graph< Vertex >::Iterator::Iterator ( )
default

Creates an iterator with no associated graph.

Member Function Documentation

◆ operator*()

template<class Vertex>
reference pgl::Graph< Vertex >::Iterator::operator* ( ) const
inline

Returns the current vertex.

◆ operator++() [1/2]

template<class Vertex>
Iterator & pgl::Graph< Vertex >::Iterator::operator++ ( )
inline

Advances to the next vertex.

◆ operator++() [2/2]

template<class Vertex>
Iterator pgl::Graph< Vertex >::Iterator::operator++ ( int )
inline

Advances to the next vertex and returns the previous position.

◆ operator->()

template<class Vertex>
pointer pgl::Graph< Vertex >::Iterator::operator-> ( ) const
inline

Returns a pointer to the current vertex.

◆ Graph

template<class Vertex>
friend class Graph
friend

◆ operator==

template<class Vertex>
bool operator== ( const Iterator & ,
const Iterator &  )
friend