title: Using lambda as an argument : std::function or template?
body: <p>I'm studying c++11 especially interested in lambda.</p>
  
  <p>After some practices, I assumed that lambda closure is an nameless function object.</p>
  
  <p>So I wrote this code.</p>
  
  <pre><code>template &lt;class callable_object&gt;
  void lambda_caller( callable_object lambda )
  {
      std::cout&lt;&lt; sizeof(lambda) &lt;&lt; endl;
      lambda();
  }
  </code></pre>
  
  <p>I know that I can use <code>std::function</code> instead of using template, but I don't want the overhead while typecasting.</p>
  
  <p>But I found one problem reading this question : <a href="https://stackoverflow.com/questions/7477310/why-cant-i-create-a-vector-of-lambda-in-c11">Why can&#39;t I create a vector of lambda in C++11?</a></p>
  
  <p>The answerer said, "Every lambda has a different type- even if they have the same signature.".</p>
  
  <p>Compilers makes different codes for different classes.</p>
  
  <p>So I think that my compiler will make another version of <code>lambda_caller</code> whenever I make another definition of lambda to pass.</p>
  
  <p>Is there any way to avoid it, except using <code>std::function</code>? Isn't there any generic type for lambda closure?</p>