Inside std::function
https://devblogs.microsoft.com/oldnewthing/20200513-00/?p=103745 [devblogs.microsoft.com]
2020-05-17 03:25
The C++ language standard library comes with a std::function template type which represents a “thing you can invoke”.
Constructing the function is a matter of creating a custom callable for the specific functor. It’s conceptually simple, but the C++ language makes us write out a bunch of stuff to get it to work.
Part 2: Storage optimization: https://devblogs.microsoft.com/oldnewthing/20200514-00/?p=103749
Storing a non-capturing lambda in a generic object: https://devblogs.microsoft.com/oldnewthing/20200515-00/?p=103755