Skip to content
Gratt-5r2 edited this page Apr 9, 2022 · 4 revisions

← Union API

class Array<T>

Constructors:
Array() - creates a new empty array.
Array( T* copy, const uint& count = Invalid ) - creates a new array and and copies data from memory
Array( Array& other ) - creates a new array with the referral memory of the other array
Array( const Array& other ) - creates a new array with the copied memory of the other array\

Methods:
T& Create( typename O init ) - creates a new element in this array with init object properties
T& Create() - creates a new element in this array
T& InsertEnd( const T& obj ) - adds a new element in the end of this array
T& Insert( const T& obj ) - adds a new element in the end of this array
T& InsertAt( const T& obj, const uint& index ) - adds a new element in the index of this array
T& InsertFront( const T& obj ) - adds a new element in the front of this array
void Remove( const T& obj ) - removes the element from this array
void RemoveAt( const uint& index ) - removes the element from this array by index
void FastRemove( const T& obj ) - removes the element from this array (unordered)
void FastRemoveAt( const uint& index ) - removes the element from this array by index (unordered)
void RemoveAtBounds( const uint& index, const uint& count ) - removes count elements from index
void Clear() - clears this array
void Delete( const T& obj ) - deletes element (with destructors) and removes element.
void DeleteAt( const uint& index ) - deletes element (with destructors) and removes element by index.
void FastDelete( const T& obj ) - deletes element (with destructors) and removes element (unordered)
void FastDeleteAt( const uint& index ) - deletes element (with destructors) and removes element by index (unordered).
void DeleteAtBounds( const uint& index, const uint& count ) - deletes (with destructors) count elements from index.
void DeleteData() - deletes all array elements (with destructors) and clears this array.
void MergeArray( const Array& other ) - adds all elements from other array to this.
void MergeArrayAt( const Array& other, const uint& index ) - adds all elements from other array to this at index.
Array& operator += ( const T& obj ) - adds a new element in the end of this array.
Array& operator += ( const Array& other ) - adds all elements from other array to this.
Array& operator |= ( const T& obj ) - adds a new element in the end if this array doesn't have this element.
Array& operator |= ( const Array& other ) - adds all elements from other array if this array doesn't have this element.
Array& operator -= ( const T& obj ) - removes (first same) elements from this array.
Array& operator -= ( const Array& other ) - removes (first same) elements from this array.
Array& operator ^= ( const T& obj ) - removes (all same) elements from this array.
Array& operator ^= ( const Array& other ) - removes (all same) elements from this array.
Array& operator = ( const Array& other ) - clears this and copies all elements from other array.
bool operator == ( const Array& other ) const - compares all elements with other array (ordered).
bool operator & ( const T& obj ) const - checks exists same element in this array.
bool CompareLinear( const Array& other ) const - compares all elements with other array (ordered).
bool CompareInsorted( const Array& other ) const - compares all elements with other array (unordered).
Array& Normalize() - removes identical files.
const T& operator[]( const uint& index ) const - returns element by index.
T& operator[]( const uint& index ) - returns element by index.
const T* GetSafe( const uint& index ) const - returns pointer to element by index. Or 0 if inexists.
T* GetSafe( const uint& index ) - returns pointer to element by index. Or 0 if inexists.
const T& GetFirst() const - returns the first element of this array.
T& GetFirst() - returns the first element of this array.
const T& GetLast() const - returns the last element of this array.
T& GetLast() - returns the last element of this array.
bool HasEqual( const typename O& obj ) const - checks exists same element in this array.
uint SearchEqual( const typename O& obj, const uint& begin = 0 ) const - returns index of element, starts at begin index.
uint CountOfEqual( const typename O& obj ) const - returns count of same elements.
void ReleaseData() - call Release method for all elements.
T& InsertSorted( const T& obj ) - adds element by sortion function.
void MergeArraySorted( const Array& other ) - adds all elements from other array by sortion functions.
T& CreateSorted( const typename O& byObj ) - creates new element in this array by sortion function with byObj order.
bool HasEqualSorted( const typename O& obj ) const - checks exists same element in this array by sortion function.
uint SearchEqualSorted( const typename O& obj ) const - returns index of the same element in this array by sortion function.
void RemoveSorted( const typename O& obj ) - removes the same element in this array by sortion function.
void DeleteSorted( const typename O& obj ) - deletes (with destructor) the same element in this array by sortion function.
uint FindIndexForObject( const typename O& obj ) const - returns best index for this object with sortion function.
Array& QuickSort() - quick sort elements.
void Copy( T** ppmem, const uint& index, const uint& count ) - copy all elements to other memory.
uint GetNum() const - count of this array elements.
bool IsEmpty() const - returns true if count of elements if 0.
uint GetTypeSize() const - returns size of T.
void SetLocatorMultiplier( const uint& rate ) - multiplier of count of preallocated slots.
void ShrinkToFit() - removes all unused preallocated clots (optimize memory).
T* begin() - address of the first element (iterator).
T* end() - address of the last element (iterator).
const T* begin() const - address of the first element (iterator).
const T* end() const - address of the last element (iterator).
const ArrayLocator<T>& GetArrayLocator() const - returns the allocator of this array.\

Clone this wiki locally