|
| Array () |
| Creates an array with empty index set. More...
|
|
| Array (Array< E, INDEX > &&A) noexcept |
| Creates an array containing the elements of A (move semantics). More...
|
|
| Array (const Array< E, INDEX > &A) |
| Creates an array that is a copy of A . More...
|
|
| Array (const ArrayBuffer< E, INDEX > &A) |
| Creates an array that is a copy of A . The array-size is set to be the number of elements (not the capacity) of the buffer. More...
|
|
| Array (INDEX a, INDEX b) |
| Creates an array with index set [a ..b ]. More...
|
|
| Array (INDEX a, INDEX b, const E &x) |
| Creates an array with index set [a ..b ] and initializes each element with x . More...
|
|
| Array (INDEX s) |
| Creates an array with index set [0..s-1 ]. More...
|
|
| Array (std::initializer_list< E > initList) |
| Creates an array containing the elements in the initializer list initList . More...
|
|
| ~Array () |
| Destruction. More...
|
|
|
These methods provide access to elements, size, and index range.
|
INDEX | low () const |
| Returns the minimal array index. More...
|
|
INDEX | high () const |
| Returns the maximal array index. More...
|
|
INDEX | size () const |
| Returns the size (number of elements) of the array. More...
|
|
bool | empty () const |
| Returns true iff there are no elements in the array. More...
|
|
const_reference | operator[] (INDEX i) const |
| Returns a reference to the element at position i . More...
|
|
reference | operator[] (INDEX i) |
| Returns a reference to the element at position i . More...
|
|
|
These methods return random-access iterators to elements in the array.
|
iterator | begin () |
| Returns an iterator to the first element. More...
|
|
const_iterator | begin () const |
| Returns a const iterator to the first element. More...
|
|
const_iterator | cbegin () const |
| Returns a const iterator to the first element. More...
|
|
iterator | end () |
| Returns an iterator to one past the last element. More...
|
|
const_iterator | end () const |
| Returns a const iterator to one past the last element. More...
|
|
const_iterator | cend () const |
| Returns a const iterator to one past the last element. More...
|
|
reverse_iterator | rbegin () |
| Returns an reverse iterator to the last element. More...
|
|
const_reverse_iterator | rbegin () const |
| Returns a const reverse iterator to the last element. More...
|
|
const_reverse_iterator | crbegin () const |
| Returns a const reverse iterator to the last element. More...
|
|
reverse_iterator | rend () |
| Returns an reverse iterator to one before the first element. More...
|
|
const_reverse_iterator | rend () const |
| Returns a const reverse iterator to one before the first element. More...
|
|
const_reverse_iterator | crend () const |
| Returns a const reverse iterator to one before the first element. More...
|
|
|
These methods can be used to reinitialize or resize the array, or to initialize all elements with a given value.
|
void | init () |
| Reinitializes the array to an array with empty index set. More...
|
|
void | init (INDEX s) |
| Reinitializes the array to an array with index set [0..s-1 ]. More...
|
|
void | init (INDEX a, INDEX b) |
| Reinitializes the array to an array with index set [a ..b ]. More...
|
|
void | init (INDEX a, INDEX b, const E &x) |
| Reinitializes the array to an array with index set [a ..b ] and sets all entries to x . More...
|
|
void | fill (const E &x) |
| Sets all elements to x . More...
|
|
void | fill (INDEX i, INDEX j, const E &x) |
| Sets elements in the intervall [i ..j ] to x . More...
|
|
void | grow (INDEX add, const E &x) |
| Enlarges the array by add elements and sets new elements to x . More...
|
|
void | grow (INDEX add) |
| Enlarges the array by add elements. More...
|
|
void | resize (INDEX newSize, const E &x) |
| Resizes (enlarges or shrinks) the array to hold newSize elements and sets new elements to x . More...
|
|
void | resize (INDEX newSize) |
| Resizes (enlarges or shrinks) the array to hold newSize elements. More...
|
|
Array< E, INDEX > & | operator= (const Array< E, INDEX > &A) |
| Assignment operator. More...
|
|
Array< E, INDEX > & | operator= (Array< E, INDEX > &&A) |
| Assignment operator (move semantics). More...
|
|
|
bool | operator== (const Array< E, INDEX > &L) const |
| Equality operator. More...
|
|
bool | operator!= (const Array< E, INDEX > &L) const |
| Inequality operator. More...
|
|
|
These following methods change the order of elements in the array.
|
void | swap (INDEX i, INDEX j) |
| Swaps the elements at position i and j . More...
|
|
void | permute (INDEX l, INDEX r) |
| Randomly permutes the subarray with index set [l ..r ]. More...
|
|
void | permute () |
| Randomly permutes the array. More...
|
|
template<class RNG > |
void | permute (INDEX l, INDEX r, RNG &rng) |
| Randomly permutes the subarray with index set [l ..r ] using random number generator rng . More...
|
|
template<class RNG > |
void | permute (RNG &rng) |
| Randomly permutes the array using random number generator rng . More...
|
|
|
These methods provide searching for values and sorting the array.
|
int | binarySearch (const E &e) const |
| Performs a binary search for element e . More...
|
|
int | binarySearch (INDEX l, INDEX r, const E &e) const |
| Performs a binary search for element e within the array section [l , ..., r ] . More...
|
|
template<class COMPARER > |
int | binarySearch (const E &e, const COMPARER &comp) const |
| Performs a binary search for element e with comparer comp . More...
|
|
template<class COMPARER > |
INDEX | binarySearch (INDEX l, INDEX r, const E &e, const COMPARER &comp) const |
| Performs a binary search for element e within the array section [l , ..., r ] with comparer comp . More...
|
|
INDEX | linearSearch (const E &e) const |
| Performs a linear search for element e . More...
|
|
template<class COMPARER > |
INDEX | linearSearch (const E &e, const COMPARER &comp) const |
| Performs a linear search for element e with comparer comp . More...
|
|
void | quicksort () |
| Sorts array using Quicksort. More...
|
|
void | quicksort (INDEX l, INDEX r) |
| Sorts subarray with index set [l , ..., r ] using Quicksort. More...
|
|
template<class COMPARER > |
void | quicksort (const COMPARER &comp) |
| Sorts array using Quicksort and a user-defined comparer comp . More...
|
|
template<class COMPARER > |
void | quicksort (INDEX l, INDEX r, const COMPARER &comp) |
| Sorts the subarray with index set [l , ..., r ] using Quicksort and a user-defined comparer comp . More...
|
|
void | leftShift (ArrayBuffer< INDEX, INDEX > &ind) |
| Removes the components listed in ind by shifting the remaining components to the left. More...
|
|
void | leftShift (ArrayBuffer< INDEX, INDEX > &ind, const E &val) |
| Removes the components listed in ind by shifting the remaining components to the left. More...
|
|
template<class E, class INDEX = int>
class ogdf::Array< E, INDEX >
The parameterized class Array implements dynamic arrays of type E.
- Template Parameters
-
E | denotes the element type. |
INDEX | denotes the index type. The index type must be chosen such that it can express the whole index range of the array instance, as well as its size. The default index type is int , other possible types are short and long long (on 64-bit systems). |
Definition at line 219 of file Array.h.