passing a vector to a function
In my program, I have a function which is supposed to manipulate the vectors passed to it. I assume that if a vector is passed to a function, a copy of it is built and any change done in the body of the function would not affect the original vector(the changes are made to the copied version).
therefore, I am trying to pass a reference of my vectors to my function. but how is it possible?
by the way I've tried passing vector * to my function but it seems that I get stuck in getting them to work.
my passed vector is :vector<Game*>* matches //Game is a defined class of mine
1.how can I tell a "for" loop to count as many times as matches.size() ?
I'm having trouble figuring out the syntax...like it'd be *(matches).size() or...what?
2. I wanna access the attributes of my Game class through the vector. I don't know how to do this either.
*(matches[k])->attribute or *(matches)[k]->attribute
I'd appreciate it a lot if you help me out.