22 template <
class T, u
int B = 1024, u
int N = B>
35 uint super_size = data.
Length();
37 SubArray &s = data[super_size - 1];
58 uint super_size = data.
Length();
59 if (super_size == 0)
return 0;
60 uint sub_size = data[super_size - 1].
Length();
61 return (super_size - 1) * B + sub_size;
90 const SubArray &s = data[index / B];
91 T &item = s[index % B];
97 const SubArray &s = data[index / B];
98 const T &item = s[index % B];
106 template <
typename D>
void Dump(D &dmp)
const 108 dmp.WriteLine(
"capacity = %d", Tcapacity);
109 uint num_items =
Length();
110 dmp.WriteLine(
"num_items = %d", num_items);
112 for (uint i = 0; i < num_items; i++) {
113 const T &item = (*this)[i];
114 name.Format(
"item[%d]", i);
115 dmp.WriteStructT(name.
Data(), &item);
bool IsEmpty() const
return true if array is empty
T * Append()
add (allocate), but don't construct item
bool IsFull()
return true if array is full
SubArray & FirstFreeSubArray()
return first sub-array with free space for new item
T * Append()
allocate but not construct new item
void Dump(D &dmp) const
Helper for creating a human readable output of this data.
bool IsFull() const
return true if array is full
void Clear()
Clear (destroy) all items.
A fixed size array that doesn't create items until needed.
FixedSizeArray< T, B > SubArray
inner array
uint Length() const
Return actual number of items.
Blob based case sensitive ANSI/UTF-8 string.
Flexible array with size limit.
T * AppendC()
allocate and construct new item
SuperArray data
array of arrays of items
static const uint Tcapacity
total max number of items
uint Length() const
return number of used items
fixed size array Upon construction it preallocates fixed size block of memory for all items...
void Clear()
Clear (destroy) all items.
T & operator[](uint index)
indexed access (non-const)
T * Data()
Return pointer to the first data item - non-const version.
T * AppendC()
add and construct item using default constructor
SmallArray()
implicit constructor
FixedSizeArray< SubArray, N > SuperArray
outer array
bool IsEmpty()
return true if array is empty