Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Const_Node_Iterator< GT > Class Template Reference

Read-only iterator on the nodes of a graph. More...

#include <tpl_const_graph_view.H>

Inheritance diagram for Aleph::Const_Node_Iterator< GT >:
[legend]
Collaboration diagram for Aleph::Const_Node_Iterator< GT >:
[legend]

Public Types

using Item_Type = const typename GT::Node *
 The type of the items: a pointer to a constant node.
 
using Set_Type = GT
 The type of the graph whose nodes are visited.
 
- Public Types inherited from Aleph::Const_Iterator< GT::Node_Iterator >
using Itor = GT::Node_Iterator
 The underlying iterator.
 
using aleph_random_access_iterator = std::conditional_t< AlephRandomAccessItor< GT::Node_Iterator >, Const_Iterator, void >
 Random access when the underlying iterator opts in; see AlephRandomAccessItor.
 

Public Member Functions

 Const_Node_Iterator ()=default
 An iterator with no current node.
 
 Const_Node_Iterator (const GT &g)
 Iterator positioned on the first node of g.
 
 Const_Node_Iterator (const Const_Graph_View< GT > &view)
 Iterator positioned on the first node seen through view.
 
Item_Type get_current_node () const
 The current node.
 
Item_Type get_current_node_ne () const noexcept
 get_current_node() without checking that there is a current node.
 
- Public Member Functions inherited from Aleph::Const_Iterator< GT::Node_Iterator >
 Const_Iterator ()=default
 A view with no current item.
 
 Const_Iterator (const C &c)
 View positioned on the first item of the container c.
 
 Const_Iterator (GT::Node_Iterator underlying) noexcept(std::is_nothrow_move_constructible_v< GT::Node_Iterator >)
 Read-only view over an existing iterator.
 
auto has_curr () const noexcept(noexcept(std::declval< I & >().has_curr())) -> decltype(std::declval< I & >().has_curr())
 true if there is a current item.
 
auto get_curr () const noexcept(noexcept(std::declval< I & >().get_curr())) -> const_iterator_detail::const_item_t< decltype(std::declval< I & >().get_curr())>
 The current item, read-only.
 
auto get_curr_ne () const noexcept(noexcept(std::declval< I & >().get_curr_ne())) -> const_iterator_detail::const_item_t< decltype(std::declval< I & >().get_curr_ne())>
 get_curr() without the checks of the underlying iterator.
 
auto next () noexcept(noexcept(std::declval< I & >().next())) -> decltype(std::declval< I & >().next())
 Move to the next item; what the underlying iterator throws.
 
auto next_ne () noexcept(noexcept(std::declval< I & >().next_ne())) -> decltype(std::declval< I & >().next_ne())
 next() without checks.
 
auto prev () noexcept(noexcept(std::declval< I & >().prev())) -> decltype(std::declval< I & >().prev())
 Move to the previous item; what the underlying iterator throws.
 
auto prev_ne () noexcept(noexcept(std::declval< I & >().prev_ne())) -> decltype(std::declval< I & >().prev_ne())
 prev() without checks.
 
auto reset_first () noexcept(noexcept(std::declval< I & >().reset_first())) -> decltype(std::declval< I & >().reset_first())
 Position the view on the first item.
 
auto reset_last () noexcept(noexcept(std::declval< I & >().reset_last())) -> decltype(std::declval< I & >().reset_last())
 Position the view on the last item.
 
auto reset () noexcept(noexcept(std::declval< I & >().reset())) -> decltype(std::declval< I & >().reset())
 Position the view on the first item.
 
auto end () noexcept(noexcept(std::declval< I & >().end())) -> decltype(std::declval< I & >().end())
 Position the view past the last item.
 
auto get_pos () const noexcept(noexcept(std::declval< I & >().get_pos())) -> decltype(std::declval< I & >().get_pos())
 Ordinal position of the current item.
 
auto set_pos (const long pos) noexcept(noexcept(std::declval< I & >().set_pos(pos))) -> decltype(std::declval< I & >().set_pos(pos))
 Position the view on the item at ordinal position pos.
 
auto is_last () const noexcept(noexcept(std::declval< I & >().is_last())) -> decltype(std::declval< I & >().is_last())
 true if the current item is the last one.
 
auto is_in_first () const noexcept(noexcept(std::declval< I & >().is_in_first())) -> decltype(std::declval< I & >().is_in_first())
 true if the current item is the first one.
 
auto is_in_last () const noexcept(noexcept(std::declval< I & >().is_in_last())) -> decltype(std::declval< I & >().is_in_last())
 true if the current item is the last one.
 
void swap (Const_Iterator &other) noexcept(std::is_nothrow_swappable_v< GT::Node_Iterator >)
 Exchange the views.
 
auto operator== (const Const_Iterator &other) const -> decltype(std::declval< I & >()==std::declval< I & >())
 Equality of the underlying iterators, when they have it.
 
auto operator!= (const Const_Iterator &other) const -> decltype(not(std::declval< I & >()==std::declval< I & >()))
 Negation of ==.
 

Private Types

using Base = Const_Iterator< typename GT::Node_Iterator >
 

Additional Inherited Members

- Protected Member Functions inherited from Aleph::Const_Iterator< GT::Node_Iterator >
GT::Node_Iterator & underlying () const noexcept
 The underlying iterator, for the views that extend the reading protocol with members of their own (the read-only iterators of the graphs do it with get_src_node() and get_tgt_node()).
 

Detailed Description

template<class GT>
class Aleph::Const_Node_Iterator< GT >

Read-only iterator on the nodes of a graph.

Wraps GT::Node_Iterator and hands out const Node *. The members that modify the graph through the iterator (del() on the graphs built on lists, for instance) do not exist.

Template Parameters
GTthe graph type.
See also
Const_Graph_View Const_Arc_Iterator Const_Node_Arc_Iterator

Definition at line 173 of file tpl_const_graph_view.H.

Member Typedef Documentation

◆ Base

template<class GT >
using Aleph::Const_Node_Iterator< GT >::Base = Const_Iterator<typename GT::Node_Iterator>
private

Definition at line 175 of file tpl_const_graph_view.H.

◆ Item_Type

template<class GT >
using Aleph::Const_Node_Iterator< GT >::Item_Type = const typename GT::Node *

The type of the items: a pointer to a constant node.

Definition at line 185 of file tpl_const_graph_view.H.

◆ Set_Type

template<class GT >
using Aleph::Const_Node_Iterator< GT >::Set_Type = GT

The type of the graph whose nodes are visited.

Definition at line 188 of file tpl_const_graph_view.H.

Constructor & Destructor Documentation

◆ Const_Node_Iterator() [1/3]

template<class GT >
Aleph::Const_Node_Iterator< GT >::Const_Node_Iterator ( )
default

An iterator with no current node.

◆ Const_Node_Iterator() [2/3]

template<class GT >
Aleph::Const_Node_Iterator< GT >::Const_Node_Iterator ( const GT &  g)
inlineexplicit

Iterator positioned on the first node of g.

Parameters
[in]gthe graph; it is not modified through the iterator.

Definition at line 196 of file tpl_const_graph_view.H.

◆ Const_Node_Iterator() [3/3]

template<class GT >
Aleph::Const_Node_Iterator< GT >::Const_Node_Iterator ( const Const_Graph_View< GT > &  view)
inlineexplicit

Iterator positioned on the first node seen through view.

Parameters
[in]viewa view of the graph.

Definition at line 201 of file tpl_const_graph_view.H.

Member Function Documentation

◆ get_current_node()

template<class GT >
Item_Type Aleph::Const_Node_Iterator< GT >::get_current_node ( ) const
inline

The current node.

Returns
a pointer to the current node.
Exceptions
std::overflow_errorif there is no current node.

Definition at line 208 of file tpl_const_graph_view.H.

References Aleph::Const_Iterator< GT::Node_Iterator >::get_curr().

◆ get_current_node_ne()

template<class GT >
Item_Type Aleph::Const_Node_Iterator< GT >::get_current_node_ne ( ) const
inlinenoexcept

get_current_node() without checking that there is a current node.

Definition at line 211 of file tpl_const_graph_view.H.

References Aleph::Const_Iterator< GT::Node_Iterator >::get_curr_ne().


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