title: c++11 vector initialization in a function call
body: <p>I have a question about the new shortcut way of defining vectors in c++11. Suppose I have the following class</p>
  
  <pre><code>struct Tester{
  
    vector&lt; vector&lt;int&gt; &gt; data;
  
    Tester(){
      data = vector&lt; vector&lt;int&gt; &gt;();
    }
  
    void add(vector&lt;int&gt; datum){
      data.push_back(datum);
    }
  
  };
  </code></pre>
  
  <p>Then, the following works as expected:</p>
  
  <pre><code>int main(){
      Tester test = Tester();
      vector&lt;int&gt; datum = vector&lt;int&gt;{1,2,3};
      test.add(datum);
  }
  </code></pre>
  
  <p>but this doesn't:</p>
  
  <pre><code>int main(){
      Tester test = Tester();
      test.add(vector&lt;int&gt;{1,2,3});
  }
  </code></pre>
  
  <p>Can someone please explain the difference to me? How can I do the shortcut I attempt in the second main()?</p>