@@ -11,13 +11,14 @@
#ifndef FIXEDSIZEARRAY_HPP
#define FIXEDSIZEARRAY_HPP
#include "../core/alloc_func.hpp"
/** fixed size array
/**
* fixed size array
* Upon construction it preallocates fixed size block of memory
* for all items, but doesn't construct them. Item's construction
* is delayed. */
template <class T, uint C>
struct FixedSizeArray {
protected:
@@ -29,13 +30,14 @@ protected:
};
/* make constants visible from outside */
static const uint Tsize = sizeof(T); // size of item
static const uint HeaderSize = sizeof(ArrayHeader); // size of header
/** the only member of fixed size array is pointer to the block
* the only member of fixed size array is pointer to the block
* of C array of items. Header can be found on the offset -sizeof(ArrayHeader). */
T *data;
/** return reference to the array header (non-const) */
FORCEINLINE ArrayHeader& Hdr() { return *(ArrayHeader*)(((byte*)data) - HeaderSize); }
/** return reference to the array header (const) */