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.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use the
<functional>header and thestd::functiontemplate class. This allows you to specify function objects with a fixed method signature.Assuming that you index the callbacks using an
unsigned int, the above map stores functions that take in twointand return anint.