5 * Copyright (c) 2007 Des Higgins, Julie Thompson and Toby Gibson.
18 SquareMat():m_dimRow(0), m_dimCol(0){;}
23 for (int i=0; i < size; i++)
27 m_2DVector.push_back(x);
30 void SetAt(int nRow, int nCol, const T& value)
32 m_2DVector[nRow][nCol] = value;
34 T GetAt(int nRow, int nCol)
36 return m_2DVector[nRow][nCol];
38 void GrowRow(int newSize)
40 if (newSize <= m_dimRow)
43 for(int i = 0 ; i < newSize - m_dimCol; i++)
45 vector<T> x(m_dimRow);
46 m_2DVector.push_back(x);
49 void GrowCol(int newSize)
51 if(newSize <= m_dimCol)
54 for (int i=0; i <m_dimRow; i++)
55 m_2DVector[i].resize(newSize);
58 void ResizeRect(int size)
71 int size = m_2DVector.size();
72 for(int i = 0; i < size; i++)
74 m_2DVector[i].clear();
84 for(int row=0; row < m_dimRow; row++)
86 for(int col=0; col < m_dimCol; col++)
88 cout << setprecision(20) << " "<< m_2DVector[row][col];
94 vector<T>& operator[](int x)
100 vector< vector <T> > m_2DVector;
101 unsigned int m_dimRow;
102 unsigned int m_dimCol;