This is a high level array class. More...
Public Types | |
typedef const_pointer | const_iterator |
typedef T const * | const_pointer |
typedef pointer | iterator |
typedef T * | pointer |
typedef T | value_type |
Public Member Functions | |
T & | at (Dtk_Size_t k) |
const T & | at (Dtk_Size_t k) const |
T & | back () |
Return the elements at the end of the array. More... | |
const T & | back () const |
Return the elements at the end of the array. More... | |
iterator | begin () |
const_iterator | begin () const |
Dtk_Size_t | capacity () const |
Returns the size of the storage space currently allocated for the array, expressed in terms of elements. More... | |
const_iterator | cbegin () const |
const_iterator | cend () const |
void | clear (int no_delete=0) |
Resets the Dtk_tab content. More... | |
T * | data () |
T const * | data () const |
Dtk_tab () | |
Default constructor. More... | |
Dtk_tab (const Dtk_tab< T > &t) | |
Dtk_tab (Dtk_Size_t initreservesize, int resize=0) | |
Dtk_tab (Dtk_tab< T > &&t) DTK_NOEXCEPT | |
Move constructor. More... | |
iterator | end () |
const_iterator | end () const |
int | find (const T &e) const |
template<typename comp > | |
int | find (const T &e, const comp &C) const |
T & | front () |
Return the elements at the beginning of the array. More... | |
const T & | front () const |
Return the elements at the beginning of the array. More... | |
const T * | GetArray () const |
Returns array of T elements. More... | |
Dtk_Size_t | GetSize () const |
T | max_element () const |
Dtk_Size_t | max_ithelement () |
T | min_element () const |
Dtk_Size_t | min_ithelement () |
Dtk_tab & | operator+= (const Dtk_tab &t) |
Dtk_tab & | operator+= (Dtk_tab &&t) |
int | operator< (const Dtk_tab< T > &t) const |
Dtk_tab & | operator= (const Dtk_tab< T > &t) |
Dtk_tab< T > & | operator= (Dtk_tab< T > &&t) DTK_NOEXCEPT |
Move assignment operator. More... | |
int | operator== (const Dtk_tab< T > &t) const |
T & | operator[] (Dtk_Size_t k) |
Accesses the ith element - like a classic array -. More... | |
const T & | operator[] (Dtk_Size_t k) const |
void | pop_back () |
Removes the last element. More... | |
void | push_back (const T &x) |
Inserts an element at the end of the array. More... | |
void | push_back (T &&x) |
Inserts an element by moving it at the end of the array. More... | |
void | reduce () |
void | remove (const T &a) |
Removes the first element with the value a. More... | |
void | reserve (Dtk_Size_t n) |
void | resize (Dtk_Size_t n) |
void | resize (Dtk_Size_t n, const T &t) |
Resizes the array. More... | |
void | reverse () |
Dtk_Size_t | size () const |
Returns the size of the array. More... | |
void | sort () |
Swap two elements. More... | |
template<typename comp > | |
void | sort (const comp &C) |
Sorts the array with custom sorting. More... | |
Dtk_tab | subtab (Dtk_Size_t a, Dtk_Size_t b) |
void | swap (const Dtk_Size_t inA, const Dtk_Size_t inB) |
Sorts the array. More... | |
~Dtk_tab () | |
This is a high level array class.
This class lets you use optimized arrays.
typedef const_pointer Dtk_tab< T >::const_iterator |
typedef T const* Dtk_tab< T >::const_pointer |
typedef T Dtk_tab< T >::value_type |
Dtk_tab< T >::Dtk_tab | ( | Dtk_Size_t | initreservesize, |
int | resize = 0 |
||
) |
Move constructor.
t | the Dtk_tab to move |
T& Dtk_tab< T >::at | ( | Dtk_Size_t | k | ) |
const T& Dtk_tab< T >::at | ( | Dtk_Size_t | k | ) | const |
T& Dtk_tab< T >::back | ( | ) |
Return the elements at the end of the array.
Sample:
const T& Dtk_tab< T >::back | ( | ) | const |
Return the elements at the end of the array.
Sample:
const_iterator Dtk_tab< T >::begin | ( | ) | const |
Dtk_Size_t Dtk_tab< T >::capacity | ( | ) | const |
Returns the size of the storage space currently allocated for the array, expressed in terms of elements.
This capacity is not necessarily equal to the size. It can be equal or greater. The capacity of the Dtk_tab can be explicitly altered by calling member Dtk_tab::reserve.
Sample:
const_iterator Dtk_tab< T >::cbegin | ( | ) | const |
const_iterator Dtk_tab< T >::cend | ( | ) | const |
void Dtk_tab< T >::clear | ( | int | no_delete = 0 | ) |
Resets the Dtk_tab content.
Sample:
T* Dtk_tab< T >::data | ( | ) |
T const* Dtk_tab< T >::data | ( | ) | const |
const_iterator Dtk_tab< T >::end | ( | ) | const |
int Dtk_tab< T >::find | ( | const T & | e | ) | const |
int Dtk_tab< T >::find | ( | const T & | e, |
const comp & | C | ||
) | const |
T& Dtk_tab< T >::front | ( | ) |
Return the elements at the beginning of the array.
Sample:
const T& Dtk_tab< T >::front | ( | ) | const |
Return the elements at the beginning of the array.
Sample:
const T* Dtk_tab< T >::GetArray | ( | ) | const |
Returns array of T elements.
Dtk_Size_t Dtk_tab< T >::GetSize | ( | ) | const |
T Dtk_tab< T >::max_element | ( | ) | const |
Dtk_Size_t Dtk_tab< T >::max_ithelement | ( | ) |
T Dtk_tab< T >::min_element | ( | ) | const |
Dtk_Size_t Dtk_tab< T >::min_ithelement | ( | ) |
Move assignment operator.
t | the Dtk_tab to move |
T& Dtk_tab< T >::operator[] | ( | Dtk_Size_t | k | ) |
Accesses the ith element - like a classic array -.
[in] | k | : The element position. |
Sample:
const T& Dtk_tab< T >::operator[] | ( | Dtk_Size_t | k | ) | const |
void Dtk_tab< T >::pop_back | ( | ) |
Removes the last element.
Sample:
void Dtk_tab< T >::push_back | ( | const T & | x | ) |
Inserts an element at the end of the array.
[in] | x | The element to insert. |
Sample:
void Dtk_tab< T >::push_back | ( | T && | x | ) |
Inserts an element by moving it at the end of the array.
[in] | x | The element to insert. |
Sample:
void Dtk_tab< T >::reduce | ( | ) |
void Dtk_tab< T >::remove | ( | const T & | a | ) |
Removes the first element with the value a.
[in] | a | The value of the element that should be removed |
Sample:
void Dtk_tab< T >::reserve | ( | Dtk_Size_t | n | ) |
void Dtk_tab< T >::resize | ( | Dtk_Size_t | n | ) |
void Dtk_tab< T >::resize | ( | Dtk_Size_t | n, |
const T & | t | ||
) |
Resizes the array.
[in] | n | The new size. |
[in] | t | The filling element. |
Sample:
void Dtk_tab< T >::reverse | ( | ) |
Dtk_Size_t Dtk_tab< T >::size | ( | ) | const |
void Dtk_tab< T >::sort | ( | ) |
Swap two elements.
Sample:
Sorts the array with custom sorting.
[in] | C | Comparison Functor |
Sample:
Dtk_tab Dtk_tab< T >::subtab | ( | Dtk_Size_t | a, |
Dtk_Size_t | b | ||
) |
void Dtk_tab< T >::swap | ( | const Dtk_Size_t | inA, |
const Dtk_Size_t | inB | ||
) |
Sorts the array.
Sample: