Cleanup dans array2d et array3d
This commit is contained in:
		| @@ -4,24 +4,22 @@ | ||||
| #include "define.h" | ||||
|  | ||||
| template <class T> | ||||
| class Array2d | ||||
| { | ||||
| public: | ||||
|     Array2d(int x, int y); | ||||
|     ~Array2d(); | ||||
|     Array2d(const Array2d& array); | ||||
| class Array2d { | ||||
|     public: | ||||
|         Array2d(int x, int y); | ||||
|         ~Array2d(); | ||||
|         Array2d(const Array2d& array); | ||||
|  | ||||
|     void Set(int x, int y, T type); | ||||
|     T Get(int x, int y) const; | ||||
|         void Set(int x, int y, T type); | ||||
|         T Get(int x, int y) const; | ||||
|  | ||||
|     void Reset(T type); | ||||
|         void Reset(T type); | ||||
|  | ||||
| private: | ||||
|     int To1dIndex(int x, int y) const; | ||||
|     private: | ||||
|         int m_x, m_y; | ||||
|         T* m_array; | ||||
|  | ||||
| private: | ||||
|     int m_x, m_y; | ||||
|     T* m_array; | ||||
|         int To1dIndex(int x, int y) const; | ||||
| }; | ||||
|  | ||||
| template <class T> | ||||
| @@ -38,14 +36,10 @@ Array2d<T>::Array2d(const Array2d<T>& array) : m_x(array.m_x), m_y(array.m_y) { | ||||
| } | ||||
|  | ||||
| template <class T> | ||||
| void Array2d<T>::Set(int x, int y, T type) { | ||||
|     m_array[To1dIndex(x, y)] = type; | ||||
| } | ||||
| void Array2d<T>::Set(int x, int y, T type) { m_array[To1dIndex(x, y)] = type; } | ||||
|  | ||||
| template <class T> | ||||
| T Array2d<T>::Get(int x, int y) const { | ||||
|     return m_array[To1dIndex(x, y)]; | ||||
| } | ||||
| T Array2d<T>::Get(int x, int y) const { return m_array[To1dIndex(x, y)]; } | ||||
|  | ||||
| template <class T> | ||||
| void Array2d<T>::Reset(T type) { | ||||
| @@ -54,8 +48,6 @@ void Array2d<T>::Reset(T type) { | ||||
| } | ||||
|  | ||||
| template <class T> | ||||
| int Array2d<T>::To1dIndex(int x, int y) const { | ||||
|     return x + (y * m_x); | ||||
| } | ||||
| int Array2d<T>::To1dIndex(int x, int y) const { return x + (y * m_x); } | ||||
|  | ||||
| #endif // ARRAY2D_H__ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user