title: How is a template instantiated?
body: <p>It's an exercise from <em>C++ Primer 5th Edition</em>:</p>
  
  <blockquote>
    <p>Exercise 16.27: For each labeled statement explain what, if any,
    instantiations happen. If a template is instantiated, explain why; if
    not, explain why not.  P.677</p>
  </blockquote>
  
  <pre><code>template &lt;typename T&gt; class Stack { };
  
  void f1(Stack&lt;char&gt;);                   // (a)
  
  class Exercise {
      Stack&lt;double&gt; &amp;rsd;                 // (b)
      Stack&lt;int&gt;    si;                   // (c)
  };
  
  int main() {
      Stack&lt;char&gt; *sc;                    // (d)
      f1(*sc);                            // (e)
      int iObj = sizeof(Stack&lt; string &gt;); // (f)
  }
  </code></pre>
  
  <p>Below is what I tried:</p>
  
  <p>(a) <code>Stack&lt;char&gt;</code> is instantiated , but no member of it is instantiated.</p>
  
  <p>(b) <code>Stack&lt;double&gt;</code> is instantiated , but no member of it is instantiated.</p>
  
  <p>(c) <code>Stack&lt;int&gt;</code> and its default constructor are instantiated.</p>
  
  <p>(d) (e) totally no idea...</p>
  
  <p>(f) <code>Stack&lt; string &gt;</code> is instantiated , but no member of it is instantiated.</p>
  
  <p>Am I right? Can anyone tell me how this code is instantiated? </p>