Re: [ROOT] TMap copy constructor

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Fri Jan 19 2001 - 19:34:28 MET


Hi Christian,

   most collection don't support copy ctors yet (only TObjArray does for the
time being). You probbaly have a TMap object in your class and no copy ctor
for this class defined. In that case CINT generates an automatic copy ctor
that will not compile since there is not TMap copy ctor. The solution is
to either:

1) Change TMap to TMap* in your class and allocate the TMap in your ctor
2) Provide an explicit copy ctor for your class where you make a proper
   loop over your TMap. CINT will in that case not generate a default one.

Case 2) is the preferred solution (even after changing TMap to a TMap*
since the default copy ctor is bogus for your class in that case anyway).

Cheers, Fons.



Christian Veelken wrote:
> 
> Hi Rooters,
> 
> I got a rather strange error message when trying to compile my code:
> 
> make
> /products/gcc-2.95/bin/g++ -c -I.
> -I/products/ROOT/2.25_03/ROOT-suse63-gcc-2.95.2/include -g -DLinux -o
> RangeSearchDict.o RangeSearchDict.cpp RangeSearchDict.cpp: In method
> `TMap::TMap(const TMap &)':
> /products/ROOT/2.25_03/ROOT-suse63-gcc-2.95.2/include/TCollection.h:53:
> `TCollection::TCollection(const TCollection &)' is private
> RangeSearchDict.cpp:198: within this context
> make: *** [RangeSearchDict.o] Error 1
> 
> The sources themselfes compile well,
> and the problem seems to be only with the rootcint generated code.
> Could it be that there is a copy constructor missing
> in some of the container classes ?
> 
> Regards,
> 
> 
> Christian Veelken (veelken@mail.desy.de)              Tel.+49-40-8998-2679
> Room 111, Building 10b
> H1 Collaboration,DESY
> __________________________________________________________________________

-- 
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 01 2002 - 17:50:34 MET