感谢036 很难蒙混过关的CArray3d三维数组模板类 - icefield817 - 博客园。
public: T *a; int n, m, o; struct CArray2D { T *a; int m, o; CArray2D(int _m, int _o, T *_a): m(_m), o(_o), a(_a) {} operator T*() { return a; } T* operator [](int j) { return a + j * o; } }; CArray3D(int _n, int _m, int _o): n(_n), m(_m), o(_o) { a = new T [n * m * o]; memset(a, 0, n*m*o*sizeof(T)); } operator T*() { return a; } CArray2D operator [](int i) { return CArray2D(m, o, a + i * m * o); }