title: convert Reference to shared pointer
body: <p>I have a function like </p>
  
  <pre><code>void Element::setNodes(const BaseClass&amp; input0, const BaseClass&amp; input1)
  </code></pre>
  
  <p>This is called by passing a derived class.</p>
  
  <pre><code>setInputNodes(DerivedClass1, DerivedClass2)
  </code></pre>
  
  <p>The trouble I have is that I want to store the nodes in a vector.  I have this</p>
  
  <pre><code>std::vector&lt;std::shared_ptr&lt;BaseClass&gt;&gt; m_inputNode;
  </code></pre>
  
  <p>and the function as </p>
  
  <pre><code>void Element::setNodes(const BaseClass&amp; input0, const BaseClass&amp; input1)
  {
  m_inputNode.push_back(input0);
  m_inputNode.push_back(input1);
  }
  </code></pre>
  
  <p>This doesn't work and I have to store it as a pointer otherwise I experience object slicing.  Will I need to change the API and pass pointers?  I want to change as little as possible.</p>