title: vector::push_back on an object without a copy-constructor -- are pointer values lost?
body: <p>I have a class, Agent, with a member attribute pointer to an object of another class, Form:</p>
  
  <p>Agent.h</p>
  
  <pre><code>...//snip includes
  class Agent{
  private:
    Form* mvForm_ptr;
    ...
  public:
    Agent();
    ~Agent();
    ...//snip additional functionality, but no copy-constructor
  };
  </code></pre>
  
  <p>Agent.cpp</p>
  
  <pre><code>#include "Agent.h"
  Agent::Agent(){
    mvForm_ptr = new Form();
  }
  Agent::~Agent(){
    delete mvForm_ptr;
  }
  ...
  </code></pre>
  
  <p>As you can see, I do not have an explicit copy-constructor for Agent.  Later, I use Agent as follows:</p>
  
  <pre><code>Agent player;
  std::vector&lt;Agent&gt; agentsVector;
  agentsVector.push_back(player);
  </code></pre>
  
  <p>This seems to be the cause of a SIGSEGV crash whose error report claims that ~Agent is throwing an EXC_BAD_ACCESS exception.  Reading up on vector::push_back <a href="http://www.cplusplus.com/reference/vector/vector/push_back/" rel="nofollow">here</a> it seems that push_back attempts to copy the passed in value.  Since I don't have a copy-constructor in class Agent, what happens to the Form pointer upon an implicit copy attempt?  If the pointed-to value is lost in the compiler-generated implicit copy-constructor, would adding an explicit copy-constructor resolve the bad access exception?  How should a copy-constructor for class Agent above be implemented?  Is this an example of the premise described by the <a href="http://en.wikipedia.org/wiki/Rule_of_three_%28C++_programming%29" rel="nofollow">Rule of Three</a>?</p>