I have Client* objects stored in my game. I want to pass a list to a Client. The Client object stores a list of Client pointers, and so the list I pass in I want to overwrite the stored list, but std::copy() is giving errors.
void Client::SetClientList(list<Client*> c)
{ _clients.clear(); std::copy(c.begin(), c.end(), _clients); }
It gives strange errors pointing to the xutility file. If I comment out the copy statement then it compiles fine so that’s the statement that it doesn’t like.
The idea is that each client stores a list of clients that are within range and therefore need to send data too.
std::copytakes 3 iterators, not 2 and a container:Also, if they are the same list type then just do this: