title: How c++ compilers extend template<> code and how does it affect speed of same?
body: <p>I am little lost with templates, and how compiler processes them.</p>
  
  <p>Needed some generic wrapper for std::vector&lt;&lt; SomeType * >>* lpVars; that is capable of performing delete on all items contained inside that vector when I delete lpVars. Something similar to the C#'s List&lt;> (generic list class).
  So I went for templates and wrote something like this:</p>
  
  <pre><code>template&lt;class T&gt;
  class ListPtr
  {
  public:
    std::vector&lt;T*&gt; items;
    ListPtr()
    { }
    ~ListPtr()
    {
      size_t count = items.size();
      for(size_t i=0; i&lt;count; i++)
      {
        T* item = items[i];
        delete item;
      }
      items.clear();
    }
    inline const int count() const
    {
      return (int)items.size();
    }
    inline T* operator[](size_t index) const
    {
      return items[index];
    }
    inline void Add(T* item)
    {
      items.push_back(item);
    }
  };
  </code></pre>
  
  <p>later on I declared global type lists like:</p>
  
  <pre><code>class SomeType1List : public ListPtr&lt;SomeType1&gt; {};
  class SomeType2List : public ListPtr&lt;SomeType2&gt; {};
  ...
  class SomeTypeNList : public ListPtr&lt;SomeTypeN&gt; {};
  </code></pre>
  
  <p><strong>Here is the first part of my interest on subject:</strong></p>
  
  <p><strong>(1)</strong> Are this classes SomeType1List, SomeType1List, ..., SomeTypeNList fully preprocessed to templates code with replaced T template type for each declaration (SomeType1, SomeType2, ..., SomeTypeN) like there is no template (are fully declared classes), or compiler performs some other magic here?</p>
  
  <p><strong>(2)</strong> And if compiler performs some other magic, how should I define this types that compiler would compile them as they are fully declared classes?</p>
  
  <hr>
  
  <p><strong>To explain usage of above code more precise:</strong></p>
  
  <p>this list instances are initialized, and returned from functions like following one:</p>
  
  <pre><code>SomeType1List* GetItems()
  {
    SomeType1List* items = new SomeType1List();
    for(int i=0; i&lt;1000; i++)
    {
      SomeType1* item = new SomeType1();
      // feed item with some data
      items-&gt;Add(item);
    }
    return items;
  }
  </code></pre>
  
  <p>and used in other parts of code like this:</p>
  
  <pre><code>SomeType1List* items = GetItems();
  int count = items-&gt;count();
  for(int i=0; i&lt;count; i++)
  {
    SomeType1* item = items[i];
    // do something with item;
  }
  delete items; // all memory occupied by items released after this line
  </code></pre>
  
  <p><strong>Second part of my interest on subject:</strong></p>
  
  <p><strong>(3)</strong> Could this be written differently using only standard classes (no boost or similar sdks)? goal is speed but to keep code clean and easy to read. So this question would be is there any better way to do all of this?</p>