Salve a tutti , sto rimplementando una classe Matrix che avevo gia` implementato come template a unico argomento .. ora sto implementandola passando le sue dimensioni come argomenti del template .. ho pero` problemi con gli operatori .. ovvero operatore di assegnamento .. posto definizione , funzione operator= ed errore .. che chiaramente non capita se le matrici han uguali dimensioni .. ma proprio non so come poter scrivere il codici per matrici con dimensioni diverse (dimensioni di partenza si intende)


codice:
template< typename mType , unsigned int r ,unsigned int c>
class Matrix;


template< typename mType , unsigned int r ,unsigned int c >
std::ostream& operator<< ( std::ostream& , Matrix<mType,r,c>& );


// MATRIX TEMPLATE
//
template< typename mType , unsigned int r = 1 ,unsigned int c = 1>
class Matrix
{
	
	template<typename T , unsigned int N , unsigned int M>
	friend std::ostream& operator<< ( std::ostream& , Matrix<T,N,M>& );

	public:
	inline Matrix();
	inline Matrix(mType);
	inline Matrix(const Matrix&);
	~Matrix();
	inline std::vector<int> size()const;
	bool resize( unsigned int , unsigned int);	
	void print()const ;
	void initialize(mType); 
	mType& operator()(unsigned int , unsigned int);
	Matrix& operator=(const Matrix&); 

	private:
	unsigned int row_ ;
	unsigned int column_ ; 
	mType **M_ ;

	bool empty;
	bool allocated ;
	bool allocate();
	bool allocate(unsigned int, unsigned int);
};
l'operatore che mi sta dando problemi e` definito cosi` :
codice:
template< typename mType, unsigned int r ,unsigned int c>
Matrix<mType,r,c>& Matrix<mType,r,c>::operator=(const Matrix<mType,r,c>& toCopy) 
{ 
	if( this == &toCopy )	
		std::cerr << "Autoassignment occured in operator=(const Matrix&) "
				<< std::endl ;
	else
	{		
		this-> allocated = this->allocate(toCopy.row_ , toCopy.column_ );

			for(unsigned int i=0; i< row_ ; i++)
				for(unsigned int j=0 ; j < column_ ; j++)
						this->M_ [i][j] = toCopy.M_[i][j] ;

		empty = false;
		
		return *this;
	
	}
}

e questo e` l'errore :

codice:
main.C: In function ‘int main()’:
main.C:22:6: error: no match for ‘operator=’ in ‘A = B’
matrix.H:253:20: note: candidate is: Matrix<mType, r, c>& Matrix<mType, r, c>::operator=(const Matrix<mType, r, c>&) [with mType = double, unsigned int r = 30u, unsigned int c = 50u]





grazie per l'aiuto