Re: std::map and root

From: Marc Escalier <escalier_at_lal.in2p3.fr>
Date: Sun, 13 Nov 2011 12:01:58 +0100


also "first" and "second" seem not to work :

indeed :

root [5] hiter(const class map<string,TH1*,less<string>,allocator<pair<const string,TH1*> > >::const_iterator)538905152

-->proof that hiter was defined

root [6] hiter.first
Error: Symbol hiter is not defined in current scope (tmpfile):1: Error: Failed to evaluate hiter.first
*** Interpreter error recovered ***

hiter nod defined ?!? impossible because it was above (and also below for proof)

root [7] hiter.second
Error: Symbol hiter is not defined in current scope (tmpfile):1: Error: Failed to evaluate hiter.second
*** Interpreter error recovered ***

-->hiter is not defined

root [8] hiter
(const class map<string,TH1*,less<string>,allocator<pair<const string,TH1*> > >::const_iterator)538905152

but here it exists !

strange...





On Sun, 13 Nov 2011, Marc Escalier wrote:

> thanks Seb and Benjamin
>
> a remaining question if you would have time :
>
> root [3] std::map<std::string,TH1*>::const_iterator hiter=hmap.begin()
> root [4] std::map<std::string,TH1*>::const_iterator theend=hmap.end()
> root [5] if (hiter!=theend) cout << "not the end yet" << endl;
>
> Error: operator!= not defined for
> map<string,TH1*,less<string>,allocator<pair<const string,TH1*> > >::iterator
> (tmpfile):1:
> *** Interpreter error recovered ***
>
> i thought that this third instruction was perfectly legal
>
> how to circumvent this ?
>
> =======================
> =======================
> On Sun, 13 Nov 2011, Sebastien Binet wrote:
>
>> Marc,
>>
>> note that if you were using the recommanded Athena release (17.0.5)
>> you'd get the dictionary for this template instantiation:
>>
>> $ asetup 17.0.5
>> $ checkPlugins.py --dump-content | grep "^map"
>> [...]
>> map<long,void*>:
>> map<string,CaloRec::Arrayrep>:
>> map<string,HepGeom::Transform3D>:
>> map<string,RooDataHist*>:
>> map<string,RooDataSet*>:
>> map<string,TH1*>:
>> map<string,bool>:
>> map<string,double>:
>> map<string,float>:
>> map<string,int>:
>> map<string,int>::iterator:
>> map<string,long>:
>> [...]
>>
>> -s
>>
>>
>> On Sun, Nov 13, 2011 at 11:31 AM, Marc Escalier <escalier_at_lal.in2p3.fr>
>> wrote:
>>> thank you Benjamin
>>>
>>> ===============
>>> ===============
>>> ===============
>>>
>>> On Sat, 12 Nov 2011, Benjamin Bannier wrote:
>>>
>>>> Hi Marc,
>>>>
>>>>> just wondering if you would have an idea on this :
>>>>>
>>>>> std::map<string,TH1*> hmap;
>>>>> std::map<std::string,TH1*>::const_iterator hiter(hmap.begin());
>>>>>
>>>>> -->Error: Can't call iterator::iterator(hmap.begin()) in current scope
>>>>
>>>> not that have any idea what happens here, but this seems fine in
>>>> 5.30.03:
>>>>
>>>>   std::map<string,TH1*> hmap;
>>>>   std::map<std::string,TH1*>::const_iterator hiter = hmap.begin();
>>>>
>>>> Welcome to CINT.
>>>>
>>>> Benjamin
>>>>
>>>>
>>>> --
>>>> "Good judgment comes from experience. Experience comes from bad
>>>> judgment."
>>>>
>>>
>>>
>
Received on Sun Nov 13 2011 - 12:02:08 CET

This archive was generated by hypermail 2.2.0 : Sun Nov 13 2011 - 17:50:01 CET