Quick Q: How is std::function implemented? -- StackOverflow
Quick A: Using type erasure.
Quick Q2: ... Um, what's that?
Quick A2: Read this post...
How is std::function implemented?
According to the sources I have found, a lambda expression is essentially implemented by the compiler creating a class with overloaded function call operator and the referenced variables as members. This suggests that the size of lambda expressions varies, and given enough references variables that size can be arbitrarily large.
An
std::functionshould have a fixed size, but it must be able to wrap any kind of callables, including any lambdas of the same kind. How is it implemented? Ifstd::functioninternally uses a pointer to its target, then what happens, when thestd::functioninstance is copied or moved? Are there any heap allocations involved?

Danny Kalev wrote a nice article yesterday about a new C++ feature -- actually, two related C++14 features -- that were just added to the draft Standard in April and will be coming to real compilers in the near future.
A nice piece of writing on a C++11 feature:
Here is a nicely accessible description of synchronization in the C++ memory model:
On CRTP with multi-level inheritance, cloning, and the constructor forwarding problem.