dimanche 1 février 2015

Convert Lambda expression to function pointer

I am using Visual-C++ 2013 (But this tag seems to be not available here).


I have a struct



struct init_param{
bool (*validation)(double**);
};


And I want to cast a member function ValidateParameters of the instance model. So I tried to use a Lambda Expression:



init_params params;
params.validation = [&model](double **par){return model.ValidateParameters(par); };


But the Compiler says:


error C2440: '=': 'main::< lambda_d8b99bf9b28e45558a48b7e9148b3202>' can not be converted into 'bool (__cdecl *)(double **)'


How to proceed? Or what is the easiest way to change the init_param struct, that hte Lambda expression would work?


Aucun commentaire:

Enregistrer un commentaire