#ifndef MATRIX_H
#define MATRIX_H
#include <vector>
using namespace std;
template <typename Object>
class matrix
{
public:
matrix(int rows,int cols):arry(rows)
{
for(auto & thisRow:arry)
thisRow.resize(cols);
}
matrix(vector<vextor<object>> V):array{v}
{ }
matrix(vector<vector<Object>>&&v):array{std::move(v)}
{ }
const vector<Object>&operator[](int row)const
{return array[row];}
vector<Object>&operatro[](int row)
{return array[row];}
int numrows() const
{return array.size();}
int numcols() const
{return numrows()? array[0].size():0;}
private:
vector<vector<Object>>array;
}
#endif
matrix类
最新推荐文章于 2023-04-08 22:19:07 发布