[ROOT] streaming const members

From: Christophe Delaere (Christophe.Delaere@cern.ch)
Date: Fri Aug 30 2002 - 15:03:01 MEST


Hi all,

I've just observed a strange feature (maybe a bug ?) when streaming
objects.
I've a rather simple class - let say simpleNode - designed to be part of
a const binary tree.

It looks like that (simplified) :

class simpleNode: public TObjArray
{
public:
	simpleNode(const simpleNode* n1, const simpleNode*
n2):parent1(n1),parent2(n2) {}
	~simpleNode() { if(parent1) delete parent1; if(parent2) delete parent2;
}
	const simpleNode* getParent(unsigned int n) const;
private:
	const simpleNode* parent1;
	const simpleNode* parent2;
}


I built an in-memory version of the tree, and I want to put it in a
TTree... and then it crashes.  When turning gDebug=2, I can see it
happens when it streams a NULL parent1 (for an end leaf).

The fact is that it seems that the problem arises because of the const
qualifier...
if it is removed (for members, and thus constructors) everything works
fine.

I don't know if it is a bug or a feature, but in the second case it
should be nice to mention it in the manual.


Cheers,
Christophe.


-- 
+-----------------------------------------------------------\|/---+
| Christophe DELAERE            office: e253               !o o!  |
| UCL - FYNU                    phone : 32-(0)10-473234    ! i !  |
| chemin du cyclotron, 2        fax   : 32-(0)10-452183     `-'   |
| 1348 Louvain-la-Neuve BELGIUM e-mail: delaere@fynu.ucl.ac.be    |
+-----------------------------------------------------------------+



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:06 MET