Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
Reverse.h
Go to the documentation of this file.
1
33#pragma once
34
35#include <utility>
36
37namespace ogdf {
38
40
45template<typename T>
46class Reverse {
49
50public:
53
55 using iterator = typename std::conditional<std::is_const<T>::value,
56 typename T::const_reverse_iterator, typename T::reverse_iterator>::type;
57
59 iterator begin() { return m_container.rbegin(); }
60
62 iterator end() { return m_container.rend(); }
63};
64
66
73template<typename T>
77
78}
A wrapper class to easily iterate through a container in reverse.
Definition Reverse.h:46
T & m_container
The container for which reverse iterators should be provided.
Definition Reverse.h:48
iterator begin()
Returns a reverse iterator to the last element of m_container.
Definition Reverse.h:59
iterator end()
Returns a reverse iterator to the one-before-first element of m_container.
Definition Reverse.h:62
Reverse(T &container)
Creates a reverse iteration wrapper for container.
Definition Reverse.h:52
typename std::conditional< std::is_const< T >::value, typename T::const_reverse_iterator, typename T::reverse_iterator >::type iterator
Provides a reverse iterator disguised a normal iterator.
Definition Reverse.h:56
Reverse< T > reverse(T &container)
Provides iterators for container to make it easily iterable in reverse.
Definition Reverse.h:74
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.