Provides some commonly useful functions for general containers.
More...
|
template<typename T > |
Reverse< T > | ogdf::reverse (T &container) |
| Provides iterators for container to make it easily iterable in reverse. More...
|
|
template<typename CONTAINER , typename T > |
int | ogdf::searchPos (const CONTAINER &C, const T &x) |
| Searches for the position of x in container C ; returns -1 if not found. More...
|
|
Provides some commonly useful functions for general containers.
◆ reverse()
template<typename T >
Reverse<T> ogdf::reverse |
( |
T & |
container | ) |
|
Provides iterators for container
to make it easily iterable in reverse.
for (
auto elem :
reverse(container)) { ... }
- Template Parameters
-
T | denotes the type of container . |
- Parameters
-
container | is the container to be reversed. |
Definition at line 74 of file Reverse.h.
◆ searchPos()
template<typename CONTAINER , typename T >
int ogdf::searchPos |
( |
const CONTAINER & |
C, |
|
|
const T & |
x |
|
) |
| |
Searches for the position of x
in container C
; returns -1 if not found.
Positions are number 0, 1, 2, ... The function uses the equality operator for comparing elements.
- Parameters
-
C | is a container. |
x | is the element to search for. |
- Template Parameters
-
T | is the type of the elements in C . |
- Returns
- the position of the first occurrence of
x
in C
(positions start with 0), or -1 if x
is not in C
.
Definition at line 236 of file basic.h.