Const-correctness in TArray* & TObjArray

From: George Heintzelman (gah@bnl.gov)
Date: Tue Jan 04 2000 - 18:48:28 MET


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



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