17 mObjects(bound0 * bound1 * bound2),
18 mIndirect1(bound1 * bound2),
21 SetPointers(mObjects.data());
30 mIndirect1(bound1 * bound2),
52Array3<T>& Array3<T>::operator=(Array3
const& other)
55 mObjects = other.mObjects;
63 *
this = std::move(other);
67Array3<T>& Array3<T>::operator=(Array3&& other)
70 mObjects = std::move(other.mObjects);
75template <
typename T>
inline
76size_t Array3<T>::GetBound0()
const
81template <
typename T>
inline
82size_t Array3<T>::GetBound1()
const
87template <
typename T>
inline
88size_t Array3<T>::GetBound2()
const
93template <
typename T>
inline
94T*
const* Array3<T>::operator[] (
int slice)
const
96 return mIndirect2[slice];
99template <
typename T>
inline
100T** Array3<T>::operator[] (
int slice)
102 return mIndirect2[slice];
106void Array3<T>::SetPointers(T* objects)
108 for (
size_t i2 = 0; i2 < mBound2; ++i2)
110 size_t j1 = mBound1 * i2;
111 mIndirect2[i2] = &mIndirect1[j1];
112 for (
size_t i1 = 0; i1 < mBound1; ++i1)
114 size_t j0 = mBound0 * (i1 + j1);
115 mIndirect2[i2][i1] = &objects[j0];
121void Array3<T>::SetPointers(Array3
const& other)
123 mBound0 = other.mBound0;
124 mBound1 = other.mBound1;
125 mBound2 = other.mBound2;
126 mIndirect1.resize(mBound1 * mBound2);
127 mIndirect2.resize(mBound2);
132 SetPointers(mObjects.data());
134 else if (mIndirect1.size() > 0)
137 SetPointers(other.mIndirect2[0][0]);
The Array3 class represents a 3-dimensional array that minimizes the number of new and delete calls....
Array3()
Default constructor.