I have not managed to find why this code does not work:
#include <iostream> #include <functional> using namespace std; int main() { auto xClosure = [](const function<void(int&)>& myFunction) { myFunction(10);}; xClosure([] (int& number) -> void {cout<<number<<endl; }); return 0; } It returns:
g++ test.cc -o test -std=c++14 test.cc:9:5: error: no matching function for call to object of type 'const function<void (int &)>'