RE: [ROOT] TString operand

From: Philippe Canal (pcanal@fnal.gov)
Date: Mon Dec 02 2002 - 23:28:04 MET


Hi Giuseppe,

In all likelyhood, you actually had in your compiled code:

	TString *s = new TString("giuseppe");
	s += " foggi";

or something equivalent.  You need to use

	TString *s = new TString("giuseppe");
	*s += " foggi";

I.e the operator += (and operator +) need to have argument of type TString
and NOT of type TString* (pointer to TString).

Cheers,
Philippe

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of
giuseppe.foggi@libero.it
Sent: Monday, December 02, 2002 3:44 PM
To: roottalk
Subject: [ROOT] TString operand


Hi,
 if I try

 root [] TString s("pippo")
 root [] TString s("giuseppe")
 root [] s+=" foggi"
 (class TString)142847368
 root [] s.Data()
 (const char* 0x89f183c)"giuseppe foggi"


 I have no problem, but if I insert these commands on my compiled script
 I get

 invalid operands of types `TString *' and `const
 char[7]' to binary `operator+'

 Why?

 The version of my ROOT is 3.02/07
 Cheers.
 Giuseppe.



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