1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| template<class T>
class matrice
{
private:
size_t nl;
size_t nc;
T** tab;
public:
//Constructors
matrice();
matrice(const size_t& li,const size_t& co,const T& val=T());
matrice(const matrice<T>& mat);
template<class U>
matrice(const matrice<U>& mat);
//Destructor
~matrice(){ Reset();}
// Operators
matrice<T>& matrice<T>::operator=(const matrice<T>& mat);
matrice<T>& matrice<T>::operator=(const T& val);
template<class U>
matrice<T>& operator=(const matrice<U>& mat);
T& operator()(const size_t& i, const size_t& j);
const T& operator()(const size_t& i,const size_t& j) const;
matrice<T>& operator+=(const matrice<T>& mat);
matrice<T>& operator-=(const matrice<T>& mat);
matrice<T>& operator*=(const matrice<T>& mat);
matrice<T>& operator+=(const T& val);
matrice<T>& operator-=(const T& val);
matrice<T>& operator*=(const T& val);
template<class U>
friend std::ostream &operator<<(std::ostream &out,matrice<U> &mat);
//Methods
inline const size_t& Line() const{return nl;}
inline const size_t& Column() const{return nc;}
bool Allocate(const size_t& li,const size_t& co);
void Reset();
template<class U>
void Initialize(const U& val);
matrice<T>& Transpose();
void Print(std::ostream& out) const;
}; |
Partager