1 #ifndef CommonTools_Utils_DynArray_H 2 #define CommonTools_Utils_DynArray_H 17 explicit DynArray(
unsigned char * storage) : a((
T*)(storage)), s(0){}
19 DynArray(
unsigned char * storage,
unsigned int isize) : a((
T*)(storage)), s(isize){
22 DynArray(
unsigned char * storage,
unsigned int isize,
T const& it) : a((
T*)(storage)), s(isize){
43 T const *
end()
const {
return a+
s;}
44 unsigned int size()
const {
return s;}
48 T const &
front()
const {
return a[0];}
49 T const &
back()
const {
return a[s-1];}
58 #define unInitDynArray(T,n,x) alignas(alignof(T)) unsigned char x ## _storage[sizeof(T)*n]; DynArray<T> x(x ## _storage) 59 #define declareDynArray(T,n,x) alignas(alignof(T)) unsigned char x ## _storage[sizeof(T)*n]; DynArray<T> x(x ## _storage,n) 60 #define initDynArray(T,n,x,i) alignas(alignof(T)) unsigned char x ## _storage[sizeof(T)*n]; DynArray<T> x(x ## _storage,n,i) 63 #endif // CommonTools_Utils_DynArray_H DynArray & operator=(DynArray &&other)
DynArray(DynArray &&other)
T const & const_reference
T const & operator[](unsigned int i) const
DynArray & operator=(DynArray const &)=delete
DynArray(unsigned char *storage, unsigned int isize, T const &it)
DynArray(unsigned char *storage, unsigned int isize)
void push_back(T const &t)
DynArray(unsigned char *storage)
unsigned int size() const
T & operator[](unsigned int i)