Re: Unaswered question

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Fri Mar 03 2000 - 17:28:47 MET


Hi Nicolas,

  I'll issue an error in case the matrices are not compatible.
You'll have to create a new matrix with the right dimensions
before assignment.

Thanks for the remarks.

Cheers, Fons.


Nicolas Produit wrote:
> 
> Let me reask this question that recived now answer yet:
> 
> In code for TMatrix operator =
> if the target matrix is not compatible with source matrix you silentely
> do nothing.
> I would have imagined that we must distroy the target matrix and create
> a new one with correct dimention?
> Or at least issue a warning message?
> Anybody can explain me the reason and is this behaviour also implicit in
> other part of root code?
> Is this common practise in C++?
> 
> TMatrix &TMatrix::operator=(const TMatrix &source)
> {
>    if (this != &source && AreCompatible(*this, source)) {
>       TObject::operator=(source);
>       memcpy(fElements, source.fElements, fNelems*sizeof(Real_t));
>    }
>    return *this;
> }
> 
> --
> Nicolas Produit
> INTEGRAL Science Data Center    Phone:  +41 22 950 91 40
> 16, Chemin d'Ecogia             Fax:    +41 22 950 91 33
> CH-1290 Versoix                 www:    http://isdc.unige.ch/

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:20 MET