mardi 28 avril 2015

C++11 lambdas capturing by reference trivially destructable

I would like to know if the following leaks memory or not (specified by the standard)

...
jmp_buf env;
if(setjmp(env) == 0) {
    auto lambda = [&] () {
        ... 
        longjmp(env, 1);
    };
    lambda();
}

which boils down to whether lambdas capturing by reference have a trivial destructor (I guess)?

I know that this is probably wicked, but has to be done nevertheless.

Aucun commentaire:

Enregistrer un commentaire