Re: Ambiguous overload resolution

From: Monika Sharma <monika_at_rcf.rhic.bnl.gov>
Date: Fri, 5 Dec 2008 15:33:21 -0500

Hi Fons,

Thanks very much.

Regards
Monika

Fons Rademakers wrote:
> 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
>>
>>
>>
>
Received on Fri Dec 05 2008 - 21:33:55 CET

This archive was generated by hypermail 2.2.0 : Fri Dec 05 2008 - 23:50:02 CET