title: push_back a pointer to a vector of pointers
body: <p>I have two classes: <code>Item</code> and <code>Box</code>. In <code>Box.h</code> I have:  </p>
  
  <pre><code>class Box {
    vector&lt;const Item *&gt; BoxItems;
  
     public:
     void AddItem(const Item *i);
  }
  </code></pre>
  
  <p>In <code>Box.cpp</code>:</p>
  
  <pre><code>void Box::AddItem(const Item *i) {
    BoxItems.push_back(*i);
  }
  </code></pre>
  
  <p>Just for reference, but in <code>main.cpp</code>:</p>
  
  <pre><code>box.AddItem(&amp;items[0]);
  </code></pre>
  
  <p><b>The problem:</b> when I compile, I get <code>error: no matching member function for call to 'push_back'</code>, referencing the <code>push_back</code> from the vector I created in <code>Box.h</code>. <b>What I am missing?</b></p>
  
  <p>So far, I have tried:</p>
  
  <pre><code>void Box::AddItem(const Item *i) {
    this -&gt; BoxItems.push_back(*i);
    Box::BoxItems.push_back(*i);
    BoxItems-&gt;push_back(*i);
  }
  </code></pre>
  
  <p>But still with the same error.</p>