Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > .Array of Vectors

Reply
Thread Tools

.Array of Vectors

 
 
gio gio is offline
Junior Member
Join Date: Nov 2007
Posts: 1
 
      11-10-2007
Good morning to all!
I'm a C++ new-newbie... and I have a problem
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[i], jet[a[cols].front()]);

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

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


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

Thanks to all!
gio
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
c++ primer statement about vectors containing vectors pauldepstein@att.net C++ 3 03-26-2008 06:22 PM
Ruby, SWIG and C++: how to properly wrap vector of vectors of doubles (2D vectors)? Ruby 0 09-14-2005 05:47 PM
Conditional Check on Vectors Analog Guy VHDL 3 10-07-2004 09:13 AM
millions combinations of test vectors for ALU Lily VHDL 16 05-10-2004 07:22 PM
Comparison of Bit Vectors in a Conditional Signal Assignment Statement Anand P Paralkar VHDL 2 08-04-2003 08:40 PM



Advertisments