#include <iostream>
#include <functional>
using namespace std;
template<typename T, typename... U>
size_t getAddress(std::function<T(U...)> f) {
typedef T(fnType)(U...);
fnType ** fnPointer = f.template target<fnType*>();
return (size_t) *fnPointer;
}
void foo(int& a) {
a = 0;
}
int main() {
std::function<void(int&)> f = &foo;
auto f2 = f;
std::function<void(int&)> f3 = [](int &a){ a = 3;};
std::cout << getAddress(f) << std::endl;
std::cout << getAddress(f2) << std::endl;
std::cout << getAddress(f3) << std::endl;
return 0;
}