Double store to vector done instead of one. lool


-----------------------------------------------------------------
EDIT : IM SO SORRY IT WAS AN IDIOT DOUBLE CALL I HAVENT SEEN SO SORRY FOR BOTHERING ANYONE I WILL MAKE MY BEST NOT TO POST AGAIN SO HASTLY
DELETE THIS TOPIC, ITS A TRASH


Ok this is not a same worthy and global appeal matter but if anyone is in the mood, may have a look at this piece of code, it reacts too "bizard" ( strange )

Im sending a vector of CLIENTS from a class to anothers class method like

CLASS AUTOWAY_SERVER:: Run(){....}
ToolPost_Entry_Sensor(vCLIENT_CENTRAL);

However each client is stored double times lool.

1
2
3
4
5
6
7
8
9
10
11
void ToolPost_Entry_Sensor(vector <CLIENT *> vCLIENT_CENTRAL)
  {
    int i=0,X;
    srand(time(NULL));
    X=rand()%vCLIENT_CENTRAL.size();//X take a random ID Number
    
    vCLIENT.push_back(vCLIENT_CENTRAL[X]);//That Client,stored to Toolpost log
    
    for (i=0;i < vCLIENT.size();i++)//Print the clients the Toolpost log has.
      cout<<"\nID:"<<vCLIENT[i]->getID();
  }


1
2
3
Output Example:
ID: 2
ID: 2


if called 2 time the function

1
2
3
4
5
6
7
8
9
Output Example:
ID: 0
ID: 0
ID: 2

ID: 0
ID: 0
ID: 2
ID: 5


lool its not like i ve forgoten something, any ideas?

-----------------------------------------------------------------
EDIT : IM SO SORRY IT WAS AN IDIOT DOUBLE CALL I HAVENT SEEN SO SORRY FOR BOTHERING ANYONE I WILL MAKE MY BEST NOT TO POST AGAIN SO HASTLY
DELETE THIS TOPIC, ITS A TRASH
Last edited on
Topic archived. No new replies allowed.