Error: Can't call vector<TH1F*,allocator<TH1F*> >::resize(2) in current scope (tmpfile):1:
Possible candidates are...
(in vector<TH1F*,allocator<TH1F*> >)
*** Interpreter error recovered ***
What could be causing this? I thought the current version of CINT supports STL! The reason I ask is b/c I would like to be able to use vector<TH1F*> in my script without having to compile it.
I’m sure that the powers that be will give a more complete response. With Root 4.02, you can do (more or less) what you want, you just need to '#include '. I use stl::vectors in uncompiled root scripts often (although I do not use the ‘resize’ function).
Cheers,
Charles
root [0] #include< vector >
root [1] std::vector< TH1F* > histVec
root [2] histVec.push_back( new TH1F ("bla", "bla", 100, 0, 5) )
root [3] histVec[0].Draw()
<TCanvas::MakeDefCanvas>: created default TCanvas with name c1
root [4] .q
I tried to reproduce your code but to no avail. I get the same error message. Unfortunately, my collaboration uses root 5.12f and above. Therefore, I am stuck with the latest version!!
However, I am surprised that you could actually loose functionality as you upgrade. Or may be the feature is just hidden away in some other corner.
Thanks anyways
Cheers
Erdos
root [0] #include< vector >
root [1] std::vector< TH1F* > histVec
root [2] histVec.push_back( new TH1F ("bla", "bla", 100, 0, 5) )
Error: Can't call vector<TH1F*,allocator<TH1F*> >::push_back(new TH1F("bla","bla",100,0,5)) in current scope (tmpfile):1:
Possible candidates are...
(in vector<TH1F*,allocator<TH1F*> >)
*** Interpreter error recovered ***
this is an annoying problem with STL of class pointers. You should create a dictionary for it, see e.g. root.cern.ch/phpBB2/viewtopic.php?t=2294 We will solve this properly once we have Reflex available in CINT.
Hi,
I still have the same problem with ROOT Version 5.34/30
[quote=“Axel”]Hi Erdos,
this is an annoying problem with STL of class pointers. You should create a dictionary for it, see e.g. root.cern.ch/phpBB2/viewtopic.php?t=2294 We will solve this properly once we have Reflex available in CINT.
Cheers, Axel.[/quote]
The link is not working.
Did you generate a dictionary for the STL collection in question? (See for example TInterpreter::GenerateDictionary). Alternatively, you should consider using ROOT v6 which does not have this problem.