copy

From: OKUMURA, Akira <oxon_at_icrr.u-tokyo.ac.jp>
Date: Thu, 22 Jun 2006 15:52:00 +0900


Hello ROOTers,

I have several questions about copy constructors and assignment operators.

  1. Automatic copy constructor and assignment operator ROOT classes have copy constructor and assignment operator which are documented in html. However some of them are not implemented in their sources nor headers. For example, http://root.cern.ch/root/htmldoc//TSpectrum.html#TSpectrum:operator= Does this mean that copy constructors and assignment operators will be created by compilers automatically ? If so, it is very confusing if the automatic ones are listed in the html document.
  2. Deep copy and shallow copy As to TSpectrum, its assignment operator seems to copy objects as 'shallow copy' in spite of its pointer members. Meanwhile e.g. TH1D has own (not automatic) assignment operator which uses ::Copy() inside it. What is the difference between these two coding styles ?
  3. assignment operator, copy constructor, Copy() and Clone() How to determine appropriate copier from the above without reading the ROOT source ?

Sincerely,

OKUMURA, Akira oxon_at_icrr.u-tokyo.ac.jp
Institute for Cosmic Ray Research, University of Tokyo 5-1-5 Kashiwanoha Kashiwa Chiba 277-8582 Japan Phone/Fax : +81 4-7136-3153
Skype : okumura.akira Received on Thu Jun 22 2006 - 08:52:11 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:59 MET