Creating a map of lambdas in C++
c++, c++11, dictionary, lambda
Solution
Use the `<functional>` header and the `std::function` template class. This allows you to specify function objects with a fixed method signature.
std::map< unsigned int, std::function<int(int,int)> > callbackMap;
Assuming that you index the callbacks using an `unsigned int`, the above map stores functions that take in two `int` and return an `int`.
Problem
How can I describe a map of lambda? I want to have a map of lambda which will be called on event (just as a simple callback). The lambda type is constant.