title: C++ Templates can't deduce Reference Types without using '&'
body: <p>Here's a very simple example:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  template&lt;typename T&gt;
  void DoubleMe(T x) {
      x += x;
  }
  
  int main()
  {
      int a = 10;
      DoubleMe(a);
      std::cout &lt;&lt; a; //displays 10 not 20!
  }
  </code></pre>
  
  <p>In cases like this, am I forced to use 'T&amp;' in the function argument instead? Cuz I have read in some tutorials that templates can correctly deduce the appropriate data type, including T*, T[ ], or T&amp; by just defining a simple 'T' before the variable. Help?</p>