uh oh, copy semantics

From: Jeff Templon (templon@studbolt.physast.uga.edu)
Date: Mon Feb 14 2000 - 22:59:27 MET


Hi Root,

a follow-on question to my earlier one.

if i have

	TLorentzVector *v1, *v2;
	TLorentzVector v3, v4;

	// do something to give values to v1 and v3 ...

	v2 = v1;
	v4 = v3;
	*v2 = *v1;

are these assignments all doing the same thing?  I might suspect that
the first one makes v2 point to the same object to which v1 is
momentarily pointing.  However the second assignment would appear to
depend on C++'s semantics for shallow vs. deep copies, as would the
third form, and I would not know whether to expect the second and
third forms to be equivalent.

I don't know how to interpret:

        TLorentzVector& operator=(const TLorentzVector& q)

It looks like addresses are being copied, but ...  Where in Lippman's
book does he such games?  Or is there another book in which I should
be looking?

At least my hair cannot go grey quickly as most of it has already
fallen out.

					JT



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