title: Passing template vector literal as a parameter
body: <p>So, lets say I have some function <code>print</code>:</p>
  
  <pre><code>template&lt;typename T&gt;
  void print(std::vector&lt;T&gt; V)
  </code></pre>
  
  <p>To pass a vector to print, I have to do </p>
  
  <pre><code>std::vector&lt;int&gt; v {1,2,3,4,5};
  print(v);
  </code></pre>
  
  <p>And that works fine. What I want to know is, is there any way to pass a vector literal to a function as a parameter?</p>
  
  <p>So our function call becomes</p>
  
  <pre><code>print({1,2,3,4,5}) 
  </code></pre>
  
  <p>and no longer requires the initialization of another temporary variable?</p>
  
  <p>I know I am able to use <code>std::initializer_list</code> but I would like to have the features of vector, <code>push_back</code>, <code>size</code>, etc. </p>
  
  <p>So, is there any way to either call the function by passing a vector literal, or is there any way in the function declaration (or call) to cast an <code>initializer_list</code> as a vector of type T?</p>
  
  <p>If it's not possible, is there a specific reason such as security?</p>
  
  <p>I know I can do it if I specify the type, such as</p>
  
  <pre><code>void print(std::vector&lt;int&gt; V);
  print({1,2,3,4});
  </code></pre>
  
  <p>But why not for templates as well? Seems like it'd be pretty much the same process. </p>