Having trouble trying to copy the vector 'sel' in main to vector 'ask' in class A.

Can someone either explain or show me?

Thanks in Advance!

class A{
private:
        
public:
vector<Trader> ask;
 void AskMatchList(vector<Trader>&);
  void showAuct();
};
void A::AskMatchList(vector<Trader> &list){
     vector<Trader>::iterator it;
     f1= new Trader; //I understand this is the WRONG WAY
     f1->BidId;      //but dont know the correct way....  :(
     f1->TraderId;
     f1->type;
     f1->quantity;
     f1->price;
     }
void A::showAuct(){
     vector<Trader>::iterator it;
     for(it=ask.begin();it!=ask.end();++it){
     it->showTrader();
     }
}   

    
     int main(){
  srand ( time(NULL) );    
  vector<Trader> sel;
  vector<Trader> buy;
  vector<Trader>::iterator it;
  A auct;

int x = 0;
    Trader* seller= new Trader[(NUMSELLER*NUMBIDS)];
    Trader* buyer= new Trader[(NUMBUYER*NUMBIDS)];
    
    //code to set the BidId,TraderId, Type, Quantity, Price
    //for sel
 
auct.AskMatchList(sel);//Suppose to copy from vector<Trader> sel TO Auctioneer classes vector

auct.showAuct();

system("pause");
return 0;
}

OKAY!!! Sorry about this people. But I found out like 10 minutes later how to do it (just by googling my title funny enough)

The way to pass one vector from one class to another class is done on this website:

http://stackoverflow.com/questions/644673/fast-way-to-copy-one-vector-into-another

OR (from that above site):
I USE THIS ONE!!!(but altered it for my use)

void copyVecFast(const vec<int>& original)
{
  vector<int> newVec;
  newVec.reserve(original.size());
  copy(original.begin(),original.end(),back_inserter(newVec));
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.