title: What is the type of a lambda function?
body: <p>In C++0x, I'm wondering what the type is of a lambda function. Specifically:</p>
  
  <pre><code>#include&lt;iostream&gt;
  
  type1 foo(int x){
   return [x](int y)-&gt;int{return x * y;};
  }
  
  int main(){
  
   std::cout&lt;&lt;foo(3)(4);//would output 12
  
   type2 bar = foo(5);
   std::cout&lt;&lt;bar(6);//would output 30
   return 0;
  }
  </code></pre>
  
  <p>What do I need to replace type1/type2 with to get the above to work? Hopefully you can see what I'm trying to accomplish, so even if this isn't possible by a direct replacement of type1 and type2, perhaps you can guide me in the right direction.</p>
  
  <p>In other words:</p>
  
  <ul>
  <li>How can I get a function to return an anonymous function?</li>
  <li>How can I assign an anonymous function to a variable?</li>
  </ul>
  
  <p>Thanks!</p>
  
  <p>Edit: I'm compiling with visual studio 2010</p>