title: C++ polymorphism without pointers
body: <p>Suppose that I have a base class <code>Animal</code> with virtual functions and some derived classes (<code>Cat</code>, <code>Dog</code>, etc.). The real derived classes contain 4-8 bytes of data. I want to store a <code>std::list&lt;Animal&gt;</code> which actually contains items which are derived objects. I want to avoid the creation of many small objects on the heap using new.</p>
  
  <p>Is there any design pattern which can be used to achieve this?</p>
  
  <p>EDIT: My ideas to implement this</p>
  
  <ol>
  <li>create <code>std::deque&lt;Cat&gt;</code>, <code>std::deque&lt;Dog&gt;</code>, ...; store <code>std::list&lt;Animal*&gt;</code> which contains pointers from the <code>deques</code>; I use the <code>std::deque</code> because I suppose that it has a good memory management with chunks of objects; </li>
  </ol>