lundi 9 mars 2015

Is every lambda function an anonymous class?


auto a = [](){};
auto b = [](){};
vector<decltype(a)> v;
v.push_back(a); //ok
v.push_back(b); //compiler error


a and b have different type.


I am wondering if each lambda function actually is kind of anonymous class, whenever we create a lambda function, we create a new class with a random name which only visible to compiler ?


Aucun commentaire:

Enregistrer un commentaire