Hi Monika,
do this:
Long_t i = 1
hname1= hname + i;
or
hname1 = hname + (long)3
there is not operator+(TString,Int_t) as that clashes with char (automatic type promotion).
Cheers, Fons.
Monika Sharma wrote:
>
> Hi Everyone,
>
> I was happily adding an integer to a TString so far in ROOT.
> Following is a very simple example of what I used to do.
>
> ===========================================
> TString hname = "c3_02pt2_Z25_Inclusive_";
> TString hname1 = "c2_02pt2_Z25_AuAu200";
> Int_t i=1;
> hname1 = hname+i;
> ===========================================
>
> Lately I upgraded ROOT to ROOT 5.21/07 (trunk_at_26568, Dec 01 2008,
> 17:44:51 on macosx64)
> and I can't seem to be able to use this operator anymore.
> Instead I get the following error message....
>
> ====================================================================
> Error: Ambiguous overload resolution (10001,3) DeltaPtPtInclusive.C:107:
> Calling : operator+(TString,Int_t);
> Match rank: file line signature
> ffffffff /Applications/root/lib/libGraf.so -1 TImage operator+(const
> TImage&,const TImage&);
> ffffffff /Applications/root/lib/libHist.so -1 TH3D
> operator+(TH3D&,TH3D&);
> ffffffff /Applications/root/lib/libHist.so -1 TH3F
> operator+(TH3F&,TH3F&);
> =====================================================================
>
> So now instead of doing the above operation, if I do the following, it
> works fine.
>
> hname1 = hname;
> hname1 += i;
>
> However, I don't want to do this way. I still want to be able to use a
> simple operation of TString+int.
>
> Is there still a way to do it?
>
> Regards
> Monika
>
>
>
-- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers_at_cern.ch Phone: +41 22 7679248 WWW: http://fons.rademakers.org Fax: +41 22 7669640Received on Fri Dec 05 2008 - 20:32:18 CET
This archive was generated by hypermail 2.2.0 : Fri Dec 05 2008 - 23:50:02 CET