mardi 3 octobre 2017

C++ lambda size

This is an example of a lambda class which cann call any lambda. It is intended to use as a functor.

template<class T>
struct lambda_class {
 T lambda;
 void operator()(){ lambda();}
};

Is there any size guarantee for this class. What I need is to store it inside a union but I cannot put this inside a union without a specific template argument. For that I need to know what the maximum size of a lambda is. It doesn't matter when it is compiler specific.

Aucun commentaire:

Enregistrer un commentaire