RE: [ROOT] Vector stl pointer problem

From: Philippe Canal (pcanal@fnal.gov)
Date: Wed Jun 25 2003 - 23:42:20 MEST


Hi Paulo,

We are planning to introduce a new implementation of the STL 'streamers'
later this summer.  This problems should disappear then (i.e. no real
support for pointer to stl containers.).

In the mean time I recommend using a vector object rather than a pointer to
a vector.

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Paulo Vitor Magacho
da Silva
Sent: Wednesday, June 25, 2003 2:31 PM
To: Roottalk
Subject: [ROOT] Vector stl pointer problem



Hello,

  I am just starting with root, and I am trying to compile a code
without using ACLiC, but I have a small problem.
  In the header file used to create a dicitionary (TC_RODFragment.h) I
have :

  ...
  vector < UInt_t *> *Data_Fragments;
  ...

  When I run the rootcint to create the dictionary there is no problem.
However inside the Streamer method I get :

  ...
  delete *Data_Fragments;
  *Data_Fragments = new vector<UInt_t*>;
  vector<UInt_t*> &R__stl = **Data_Fragments;
  R__stl.clear();
  TClass *R__tcl1 = TBuffer::GetClass(typeid(unsigned int*));
  int R__i, R__n;
  R__b >> R__n;
  R__stl.reserve(R__n);
  for (R__i = 0; R__i < R__n; R__i++) {
      unsigned int* R__t;
      R__b.StreamObject(&R__t,R__tcl1);
      R__stl.push_back(R__t);
  }
  ...

  However this causes an error when trying to compile. What I had to do is
to change it by hand to, so I don't get any errors :

  ...
  delete Data_Fragments;
  Data_Fragments = new vector<UInt_t*>;
  vector<UInt_t*> &R__stl = *Data_Fragments;
  ...

  My question is, why did it create inside the Streamer method
*Data_Fragments instead of Data_Fragments, I how can I fix it without have
to edit the file myself ?

Thanks in advance,

 Paulo da Silva

--
Paulo Vitor Magacho da Silva
Office: 40-R-D01			Tel.: (+41 22) 76 71.287/73.019
ATLAS / EP / CERN			Fax.: (+41 22) 76 78.350
CH-1211 Geneve 23 - Suisse/Switzerland  email: Paulo.Da.Silva@cern.ch



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET