Inherits List, but contains it's elements in a sorted manner.
More...
#include <OrderedList.hpp>
|
|
| OrderedList (const T *elements, unsigned elementsCount) |
| |
| void | add (T element)=delete |
| |
| void | insertAt (T element, unsigned index)=delete |
| |
| void | insert (T element) |
| | Inserts an element at a sorted position. More...
|
| |
|
| List (const T *elements, unsigned elementsCount) |
| | Copies all elements in given array.
|
| |
| void | add (const T &element) |
| | Adds an element. More...
|
| |
| void | insertAt (const T &element, unsigned index) |
| | Inserts element at given index. More...
|
| |
| bool | removeAt (unsigned index) |
| | Removes element at index. More...
|
| |
| unsigned | findIndex (const T &element) const |
| | Finds the index of element. More...
|
| |
| bool | contain (const T &element) const |
| |
|
T & | operator[] (unsigned index) |
| | Returns reference to element at index.
|
| |
|
const T & | operator[] (unsigned index) const |
| | Returns constant reference to element at index.
|
| |
|
List< T > & | operator+= (const List< T > other) |
| | Appends elements from other list.
|
| |
| std::istream & | read (std::istream &istr) |
| | Reads from stream. More...
|
| |
| std::ostream & | write (std::ostream &ostr) const |
| | Writes to stream. More...
|
| |
| unsigned | get_length () const |
| | Returns the length. More...
|
| |
| unsigned | get_count () const |
| | Returns the count. More...
|
| |
|
List & | operator= (const List &other) |
| |
|
| List (const List &other) |
| |
|
| List (List &&other) |
| |
|
List & | operator= (List &&other) |
| |
|
|
void | resize () |
| |
|
void | free () |
| |
|
void | copyFrom (const List &other) |
| |
|
T * | elements |
| |
|
unsigned | length |
| |
|
unsigned | count |
| |
template<typename T>
class OrderedList< T >
Inherits List, but contains it's elements in a sorted manner.
- Warning
- Outside those defined in List, insert() requires the type to have defined a "compare" of functions.
- See also
- insert()
◆ add()
◆ insert()
Inserts an element at a sorted position.
- Warning
- The function depends on the type having a function "compare" defined, which takes two elements and returns a number <0 if elem1 < elem2, >0 if elem1 > elem2, 0 if elem1 == elem2
- Note
- Insertion is done linearly
◆ insertAt()
template<typename T >
| void OrderedList< T >::insertAt |
( |
T |
element, |
|
|
unsigned |
index |
|
) |
| |
|
delete |
The documentation for this class was generated from the following file: