I am trying to assign a pointer to lambda function to pointer to another lambda function. The code will speak for itself:
#include <iostream>
int main(int argc, char *argv[]) {
auto l1 = []() { std::cout << "Lambda 1!" << std::endl; };
auto l2 = [] { std::cout << "Lambda 2!" << std::endl; };
auto l1p = &l1;
l1p = &l2; // Why can't I do this assignment?
return 0;
}
Since the return types and argument of both lambda functions are the same, can't I do this assignment?
Aucun commentaire:
Enregistrer un commentaire