I have the following class:
public:
Client(tcp::socket socket)
: socket_(std::move(socket))
{
}
void start();
int connectionId;
Than I have the following vector:
class Server {
public:
Server();
static std::vector<std::shared_ptr<Client>> Clients;
}
EDIT*
Can I do something like this:
for (int i = 0; i < Server::Clients.size(); ++i) {
if(Server::Clients[i]->connectionId == connectionId)
Server::Clients.erase(Server::Clients.begin()+i);
}
My question is how can I remove the shared pointer in Clients
with a specific connectionId
aka remove by value?