Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <class X>
- class array2
- {
- public:
- array2(const int row_count = 0, const int col_count = 0) : rows (row_count), cols(col_count)
- {
- m_arr = new X*[rows];
- for (int r = 0; r < rows; ++ r )
- m_arr[r] = new X[cols];
- }
- X & operator() ( const int r, const int c )
- {
- return m_arr[r-1][c-1];
- }
- private:
- int rows, cols;
- X ** m_arr;
- };
Advertisement
Add Comment
Please, Sign In to add comment