How to add a 'new' class to a vector
<p>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 </p>

<pre><code>clients.push_back(new client(addr,fd));
</code></pre>

<p>to add a client object to the vector clients. I get the following error on compile</p>

<pre><code>server.cpp:67: error: no matching function for call to ‘std::vector&lt;client, std::allocator&lt;client&gt; &gt;::push_back(client*)
</code></pre>

<p>I think it has something to do with my misunderstanding of the <code>new</code> 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++.</p>
