18 mObjects(bound0 * bound1 * bound2 * bound3),
19 mIndirect1(bound1 * bound2 * bound3),
20 mIndirect2(bound2 * bound3),
23 SetPointers(mObjects.data());
33 mIndirect1(bound1 * bound2 * bound3),
34 mIndirect2(bound2 * bound3),
57Array4<T>& Array4<T>::operator=(Array4
const& other)
60 mObjects = other.mObjects;
68 *
this = std::move(other);
72Array4<T>& Array4<T>::operator=(Array4&& other)
75 mObjects = std::move(other.mObjects);
80template <
typename T>
inline
81size_t Array4<T>::GetBound0()
const
86template <
typename T>
inline
87size_t Array4<T>::GetBound1()
const
92template <
typename T>
inline
93size_t Array4<T>::GetBound2()
const
98template <
typename T>
inline
99size_t Array4<T>::GetBound3()
const
104template <
typename T>
inline
105T**
const* Array4<T>::operator[] (
int cuboid)
const
107 return mIndirect3[cuboid];
110template <
typename T>
inline
111T*** Array4<T>::operator[] (
int cuboid)
113 return mIndirect3[cuboid];
117void Array4<T>::SetPointers(T* objects)
119 for (
size_t i3 = 0; i3 < mBound3; ++i3)
121 size_t j2 = mBound2 * i3;
122 mIndirect3[i3] = &mIndirect2[j2];
123 for (
size_t i2 = 0; i2 < mBound2; ++i2)
125 size_t j1 = mBound1 * (i2 + j2);
126 mIndirect3[i3][i2] = &mIndirect1[j1];
127 for (
size_t i1 = 0; i1 < mBound1; ++i1)
129 size_t j0 = mBound0 * (i1 + j1);
130 mIndirect3[i3][i2][i1] = &objects[j0];
137void Array4<T>::SetPointers(Array4
const& other)
139 mBound0 = other.mBound0;
140 mBound1 = other.mBound1;
141 mBound2 = other.mBound2;
142 mBound3 = other.mBound3;
143 mIndirect1.resize(mBound1 * mBound2 * mBound3);
144 mIndirect2.resize(mBound2 * mBound3);
145 mIndirect3.resize(mBound3);
150 SetPointers(mObjects.data());
152 else if (mIndirect1.size() > 0)
155 SetPointers(other.mIndirect3[0][0][0]);
The Array4 class represents a 4-dimensional array that minimizes the number of new and delete calls....
Array4()
Default constructor.