Vector<int> in make class

Hello,

I have this tree that has std::vector values and std::vector values. I did make class on the tree and although variables seems OK, values are not working. For eg.

for (int i=0; i<Truth_N; ++i) { cout<<"testing eta "<< (*Truth_eta)[i]<<endl; cout<<"testing pdgId "<< (*Truth_pdgId)[i]<<endl; }
(values are available as pointer of vector, that why need to dereference)

results in

root [0] .L test.C root [1] test a Warning in <TClass>: no dictionary for class AttributeListLayout is available Warning in <TClass>: no dictionary for class pair<string> is available root [2] a.Loop() testing eta -0.694072 Error: Can't call vector<int,allocator<int> >::operator[](i) in current scope test.C:44: Possible candidates are... (in vector<int,allocator<int> >) testing pdgId (class G__CINT_ENDL)77027296 *** Interpreter error recovered ***

Is there any known problem with vector?

Hi,

what root version, what OS? Did you build ROOT yourself? Did you run “make cintdlls”?

Axel.

Hi Axel

version: Version 5.11/02 19 April 2006
MacOSX 10.4.7 (Intel)
I didn’t compile myself, I picked up from somewhere but I can’t remember where.
I didn’t run make cintdlls and I don’t know what that does.

Do you think I should move to newer version?

Thanks for your help.
Akira

Hi,

I have no problems running[code]void check(vector* vi, vector* vd)
{
cout << "check int: " << (*vi)[1] << endl;
cout << "check double: " << (*vd)[1] << endl;
cout << "check int: " << (*vi)[0] << endl;
}

void vecptr()
{
vector vi;
vi.resize(3);
vi[0]=17;
vi[1]=42;
vi[2]=13;

vector vd;
vd.resize(2);
vd[0]=0.17;
vd[1]=0.42;

check(&vi, &vd);
}[/code] I tried with ROOT’s current CVS version on linux. Does that work for you, too? If not, could you provide us with a working example of your code showing the problem?

Cheers, Axel.

Hi

Thank you for your help.

I tried this code and I had exactly the same problem. I’ll try with the new binary from root site and come back to it.

Cheers
Akria

Hello

It seems the problem was related to the binary I had. Now that I installed 5.12/00 MacOS binary, the problem dissappeared.

So sorry for the noise and thank you for your help!

Cheers
Akira