! | ΠΠ°Π½Π½Π°Ρ ΠΈΠ½ΡΠΎΡΠΌΠ°ΡΠΈΡ ΠΏΡΠ΅Π΄Π½Π°Π·Π½Π°ΡΠ΅Π½Π° ΡΠΎΠ»ΡΠΊΠΎ ΡΠΎΠ»ΡΠΊΠΎ Π΄Π»Ρ IT-ΡΠΏΠ΅ΡΠΈΠ°Π»ΠΈΡΡΠΎΠ² ΠΏΠΎ ΡΠΈΡΡΠ΅ΠΌΠ½ΠΎΠΉ ΠΈΠ½ΡΠ΅Π³ΡΠ°ΡΠΈΠΈ ΠΌΠΎΠ΄ΡΠ»Π΅ΠΉ ΠΠΠΠ‘ΠΠ€Π’-Π. (ΡΠΌ. Π ΡΠΊΠΎΠ²ΠΎΠ΄ΡΡΠ²Π° ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»Ρ ΠΊ ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΠ½ΡΠΌ ΠΏΡΠΎΠ΄ΡΠΊΡΠ°ΠΌ) |
int GetCount() const;
void SetCount( int nNewCount, int nGrowBy = -1);
// with alloc success check (alternatively you may just compare to GetCount()) bool SetCountIsOk( int nNewCount, int nGrowBy = -1);
// bypassing sane limits, will try to alloc any size but malloc may still fail bool SetCountBeyondUniversalLimit( int nNewCount, int nGrowBy = -1);
// Check if memory allocated int GetConsumedMemoryInBytes();
TYPE GetAt(int iAt) const;
TYPE GetLast(int nCountMinus = -1) const;
void SetAt(int iAt, const TYPE& value);
// Safe access outside of array TYPE GetAtOr(int iAt, const TYPE& def) const; TYPE GetLastOr(int nCountMinus, const TYPE& def) const;
// for non ref/ptr projects (Cx, console) nullable<TYPE> GetAtOrNull(int iAt) const; nullable<TYPE> GetLastOrNull(int nCountMinus = -1) const;
// read only! const TYPE operator [] (int iAt) const;
// removed to simplify error handling, use SetAt() to change elements instead //TYPE& operator [] (int iAt);
TYPE& Add(const TYPE& value);
// array fill shortcut mainly to simpify tests array<TYPE>& operator << (const TYPE& value);
void InsertAt(int iAt, const TYPE& value); void InsertAt(int iAt, const TYPE& value, int nCount); void InsertAt(int nStartIndex, const array& oNewArray);
void RemoveAt(int iAt, int nCount = 1);
void RemoveAll();
// Filter out items using flexible template template<class FILTER> void RemoveMatchingTemplate( FILTER oFilter);
void Append(const array& src); void AppendBeyondUniversalLimit(const array& src);
void Copy(const array& src);
bool Iterate( out iter& out_i, out TYPE& out_value) const;
bool IterateBackwards( out iter& out_i, out TYPE& out_value) const;
bool IterateKeys( out iter& out_i, out int& out_key, out TYPE& out_value) const;
bool IterateKeysBackwards( out iter& out_i, out int& out_key, out TYPE& out_value) const;
// Common sense functions void Fill(const TYPE& val); void Fill(const TYPE& val, int nStartIndex, int len);
int Find(const TYPE& val, int nStartIndex = 0) const; int FindCount(const TYPE& val) const;
TYPE FindMin(); TYPE FindMax(); // This INCLUDES the last index (which is illogical behaviour) TYPE FindMinInRange( int iStart, int iEnd); TYPE FindMaxInRange( int iStart, int iEnd);
void ReverseOrder();
// This INCLUDES the last index (which is illogical behaviour) void ReverseOrderInRange( int iStart, int iEnd);
void SortAscending(); void SortDescending();
template<class SORTER> void Sort( SORTER& sorter);
// Generic templateless sorter void SortRefs( ref<CSorter> rSorter); void SortPtrs( ref<CSorter> rSorter);
// do not call direcly! void _internal_unsafe_SortWithLowLevelCompareFunction( ref<CSorter> rSorter, PFN_QsortCallback pfnQsortCallback);
// Universal square filter void RunSquareFilter( out array<TYPE>& out_atypeResult, int nWindowLength) const; void RunSquareFilterOnRange( out array<TYPE>& out_atypeResult, int nWindowLength, int iFirstElement, int iLastElement) const;
// Simple sum value TYPE CalcSumFromTo( int iFirstElement, // (including iFirst/iLast, saturated if out of bounds) int iLastElement, TYPE typePadding = TYPE()) // useful for concatenating str const;
ΠΠΎΠ±Π°Π²Π»Π΅Π½ ΠΏΠ°Π΄Π΄ΠΈΠ½Π³ Π΄Π»Ρ Π°Π΄Π°ΠΏΡΠ°ΡΠΈΠΈ ΠΊ ΡΠ»ΠΈΡΠ½ΠΈΡ ΡΡΡΠΎΠΊ ΡΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅ΠΌ. ΠΠ΅ ΡΠΎΠ»ΡΠΊΠΎ ΡΠΈΡΠ΅Π». ΠΠΎΠ»Π΅Π·Π½ΠΎ Π΄Π»Ρ Π΄Π°ΠΌΠΏΠΎΠ² ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ² Π² ΡΠ΅ΡΡΠ°Ρ
str sDump = asTest.CalcSumFromTo(0, oo, ", "); TESTLOG("", sDump + "\n");
// Simple average value TYPE CalcAverageFromTo( int iFirstElement, // (including iFirst/iLast, saturated if out of bounds) int iLastElement) const;
// Fill output array with consecutive value differences void CalcDeltas( int iFirstElement, // (including iFirst/iLast, saturated if out of bounds) int iLastElement, out array<TYPE>& out_aResult) const; // result.size := (this->size - 1)
// Clear and refill from a buffer // May fail if alignment is wrong or on memory alloc. // (FOR SIMPLE int/struct TYPES ONLY!) bool ImportArrayFromSbuf( sbuf sbufSource);
// Change a number of existing items from a buffer // May fail if index alignment is wrong or on memory alloc. // Will try to grow array. // (FOR SIMPLE int/struct TYPES ONLY!) bool OverlayArrayFromSbuf( int iStartAt, sbuf sbufSource);
// Change a number of existing items from the specified buffer segment // May fail if index alignment is wrong or on memory alloc. // Will try to grow array. // (FOR SIMPLE int/struct TYPES ONLY!) bool OverlayArrayFromSbufPartial( int iArrayStartAt, int iItemCount, sbuf sbufSource, int iInitialBufferOffset);
// Copy full array into cleared buffer // Can fail on memory alloc. // (FOR SIMPLE int/struct TYPES ONLY!) bool ExportArrayToSbuf( out sbuf& out_sbufTarget);
// Fill/append a buffer from array items // It can work as append to exising string or create a new one // Can fail on memory alloc. // Will try to grow sbuf. // (FOR SIMPLE int/struct TYPES ONLY!) bool ExportArrayToSbufPartial( int iStartAt, int nItemCount, out sbuf& out_sbufTarget, int iInitialTargetOffset);
// Direct Access to the element data (may return NULL) const TYPE* _unsafe_GetPointer() const; TYPE* _unsafe_GetPointer(); int _unsafe_GetSizeInBytes();
// More safe than _unsafe_GetPointer() direct handling // (it does not do SetCount() because you may // want to preset SetCountBeyondUniversalLimit()) void _unsafe_ImportRawBuffer( const TYPE* pSource, int nSourceCount);
// No index verification in release TYPE _unsafe_GetAt(int iAt) const; void _unsafe_SetAt(int iAt, const TYPE& value); TYPE& _unsafe_ElementAt(int iAt);
// Free removed element memory void FreeExtra();
ΠΡΠ° ΠΊΠ°ΡΠ΅Π³ΠΎΡΠΈΡ Π² Π΄Π°Π½Π½ΡΠΉ ΠΌΠΎΠΌΠ΅Π½Ρ ΠΏΡΡΡΠ°.