title: pass function by value (?) instead of function pointer?
body: <p>Sorry if this has been asked before, but I was unable to find it.</p>
  
  <p>So im trying to educate myself about templates and the new C++11 features (mainly lambdas, something I always liked in other languages).</p>
  
  <p>But in my tests I came to something I had no idea it worked, and I'm trying to understand how it works but cant figure it out..</p>
  
  <p>The following code:</p>
  
  <pre><code>template &lt;class Func&gt;
  void Test( Func callback ) {
      callback( 3 );
  }
  
  void Callback( int i ) {
      std::cout &lt;&lt; i &lt;&lt; std::endl;
  }
  
  int main( int argc, char** argv ) {
      Test( &amp;Callback ); // this I was expecting to work, compiler will see its a pointer to a function
      Test( Callback ); // this also works, but how?!
      return 0;
  }
  </code></pre>
  
  <p>If I understand how templates work, basically they're a scheme for the compiler to know what to build, so the first call <code>Test( &amp;Callback );</code> I was expecting to work because the compiler will see the template receives a function address and will assume the arguments should be a pointer.</p>
  
  <p>But what is the second call? What is the template assuming it is? A copy of a functio (if that even makes any sense)?</p>