title: difference between auto and decltype in c++0x
body: <p>I'm having trouble with auto and decltype.</p>
  
  <pre><code>void f(const vector&lt;int&gt;&amp; a, vector&lt;float&gt;&amp; b)
  {
      typedef decltype(a[0]*b[0]) Tmp;
      for (int i=0; i &lt; b.size(); ++i) {
        auto p0 = new auto(a[i]*b[i]);
        auto p1 = new decltype(a[i]*b[i]);
        *p0=a[i]*b[i];
        *p1=a[i]*b[i];
        cout&lt;&lt;*p0&lt;&lt;endl;
        cout&lt;&lt;*p1&lt;&lt;endl;
        delete p0;
        delete p1;
     }
  }
  
   int main()
  {
  
      vector&lt;float&gt;vec2;
      vec2.push_back(2.0);
  
      vector&lt;int&gt;vec1;
      vec1.push_back(5);
  
      return 0;
  }
  </code></pre>
  
  <p>The above code runs well in GCC4.7. Could I use 'new auto(a[0]*b[0])' to allocate memory for the type of a[0]*b[0]? And I can not distinguish the difference between decltype and auto in this case.</p>