.Array of Vectors

gio

Joined
Nov 10, 2007
Messages
1
Reaction score
0
Good morning to all!
I'm a C++ new-newbie... and I have a problem :guru:
i' ve to manage an array of vector:

int NumCols=1;
vector<int> a[NumCols];

then i should initialize the first (and at all, only) element of the fisrt vector with 0 value.
and so i write:

a[0].push_back(0);

But this give me an error
Error: non class,struct,union object a[0] used with . or -> FILE:L.C LINE:165

Could you give me some hint?

After this i have to increment NumCols (in a cycle when some conditions are satisfied):

for (i=1; i<jet.size(); i++){
for (int cols=0; cols<NumCols; cols++){
CalculateDR(jet, jet[a[cols].front()]);

if (DR> DRref){
NumCols++;
a[NumCols].push_back(jet.Label);
break;
}

if (DR <= DRref){
a[cols].push_back(jet.Label);
break;
}
}
}


as i ve already wrote, i m a newbie and so i suppose that there are many errors.....

Thanks to all!
gio
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top