Vector<vector<double>> error

i’m trying to read this variable in ROOT v5.18

std::vector<std::vector<double> > *Tru_ParentIDs;

doing something like

for(int y=0 ; y < size ; y++ ){ ... std::vector<double> v = object->Tru_ParentIDs->at(y); ... }

but i got this

I have created for that

[code]#ifdef CINT
#pragma link C++ class std::vector< std::vector >;
#endif

template class std::vector< std::vector >;
[/code]

Any idea what i’m doing wrong?
How should i loop over/access a vector<vector>* structure?

Cheers,
Martin

Is object->Tru_ParentIDs initialized? Is ‘size’ really set to the actually size of the outer vector? Does the code work in compile mode? Did you try running in compile mode with valgrind?

Cheers,
Philippe.

[quote=“pcanal”]Is object->Tru_ParentIDs initialized? Is ‘size’ really set to the actually size of the outer vector? Does the code work in compile mode? Did you try running in compile mode with valgrind?
[/quote]

Hi philippe,

yes it is initialized (i made the class via TTree::MakeClass() ) and size=object->Tru_ParentIDs->size()

So far i did try to run it only in interprete mode. i’ll try compiling it .

Now , object->Tru_ParentIDs[i][j] works fine but not via at() method.

Cheers, Martin

Hi,

Could you please send a complete running example?

Thanks,
Philippe