I am writing a server in C++ and created a class called client to store information about connected clients. I wanted to store the clients in a vector. I have a call
clients.push_back(new client(addr,fd));
to add a client object to the vector clients. I get the following error on compile
server.cpp:67: error: no matching function for call to ‘std::vector<client, std::allocator<client> >::push_back(client*)
I think it has something to do with my misunderstanding of the new
keyword and how data is stored/moved in C++. I come from a Java background, so I am not use to pointers and memmory stuff of C++.