Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
ogdf::Reverse< T > Class Template Reference

A wrapper class to easily iterate through a container in reverse. More...

#include <ogdf/basic/Reverse.h>

Public Types

using iterator = typename std::conditional< std::is_const< T >::value, typename T::const_reverse_iterator, typename T::reverse_iterator >::type
 Provides a reverse iterator disguised a normal iterator.
 

Public Member Functions

 Reverse (T &container)
 Creates a reverse iteration wrapper for container.
 
iterator begin ()
 Returns a reverse iterator to the last element of m_container.
 
iterator end ()
 Returns a reverse iterator to the one-before-first element of m_container.
 

Private Attributes

T & m_container
 The container for which reverse iterators should be provided.
 

Detailed Description

template<typename T>
class ogdf::Reverse< T >

A wrapper class to easily iterate through a container in reverse.

Template Parameters
Tdenotes the container type.

Definition at line 46 of file Reverse.h.

Member Typedef Documentation

◆ iterator

template<typename T >
using ogdf::Reverse< T >::iterator = typename std::conditional<std::is_const<T>::value, typename T::const_reverse_iterator, typename T::reverse_iterator>::type

Provides a reverse iterator disguised a normal iterator.

Definition at line 55 of file Reverse.h.

Constructor & Destructor Documentation

◆ Reverse()

template<typename T >
ogdf::Reverse< T >::Reverse ( T &  container)
inlineexplicit

Creates a reverse iteration wrapper for container.

Definition at line 52 of file Reverse.h.

Member Function Documentation

◆ begin()

template<typename T >
iterator ogdf::Reverse< T >::begin ( )
inline

Returns a reverse iterator to the last element of m_container.

Definition at line 59 of file Reverse.h.

◆ end()

template<typename T >
iterator ogdf::Reverse< T >::end ( )
inline

Returns a reverse iterator to the one-before-first element of m_container.

Definition at line 62 of file Reverse.h.

Member Data Documentation

◆ m_container

template<typename T >
T& ogdf::Reverse< T >::m_container
private

The container for which reverse iterators should be provided.

Definition at line 48 of file Reverse.h.


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