dimanche 22 septembre 2019

I can't pass lambda with reference capture

Following code fails with this error

E0413 no suitable conversion function from "lambda []float (int i)->float" to "float (*)(int i)" exists

int test;   
float (*f)(int i) = [&](int i) -> float {return test; };

How do I fix this? I need the Capture clause.

Aucun commentaire:

Enregistrer un commentaire