Re: Const-correctness in TArray* & TObjArray

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Wed Jan 05 2000 - 10:55:34 MET


Hiu George,

   I'll make your proposed changes.

However, note that Class() is a static method and there const makes no sense.

Cheers, Fons.


George Heintzelman wrote:
> 
> Hi Rooters,
> 
> For const-correctness, there should be some fixes in TArray* and
> TObjArray.
> 
> 1) At() should be defined as const in all the TArray* routines. In
> TObjArray, it is more of a design decision but IMHO there should be two
> versions. One version would return a const TObject * and be const, the
> other returning a TObject * and being non-const.
> 
> 2) operator[] should have two versions in all these classes. One verion
> should return the reference and be non-const. The second should return
> a reference to a const whatever and be const. In TObjArray this ought
> to be (IMHO):
>         const TObject * const & operator[](int) const;
> // or   const TObject * operator[](int) const;  also works.
>         TObject *& operator[](int);
> 
> Also, Class() should be const in every class in ROOT.
> 
> George Heintzelman

-- 
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:16 MET