I got problem with STL vectors if I store own definded struct
data to vector.
First example works well but
seconds fails depend on size of vector which is wierd.
I excuted macros from the interactive mode.
Did I do something wrong?
#################################
This is test1.C which works well.
#include
{
vector the_list;
for(Int_t i=0; i<400; i++)
{
the_list.push_back(gRandom->Gaus(0,1));
}
}
#################################
This is test2.C which fails with segmentation violation
#include
struct thePoint {
Double_t x;
Double_t y;
};
void test2(){
vector the_list;
for (Int_t i=0; i<10; i++)
{
thePoint p;
p.x = gRandom->Gaus(0,1);
p.y = gRandom->Gaus(0,1);
the_list.push_back§;
}
cout << “It’s OK so far” << endl;
for (Int_t i=0; i<100; i++)
{
thePoint p;
p.x = gRandom->Gaus(0,1);
p.y = gRandom->Gaus(0,1);
the_list.push_back§;
}
cout << “done” << endl;
}